Response: Previous Transaction Reference (previous_tran_ref)
This parameter behaving the same regardless of the integration type you are using.
In the dynamic realm of online transactions, ensuring seamless and efficient payment processes is crucial. PayTabs introduces the previous_tran_ref
parameter, a vital component designed to enhance the follow up transactions tracking and management. This parameter allows merchants to reference their current follow up transaction to its prior/main transaction, facilitating smoother operations for follow-up actions such as captures, refunds, or voids.
By leveraging the previous_tran_ref
parameter, businesses can maintain a clear and organized transaction history, ensuring that each subsequent action is accurately linked to its original transaction. This not only aids in better record-keeping but also enhances the overall transaction experience for both merchants and customers.
Understanding the key parameters such as previous_tran_ref
, tran_ref
, and tran_type
enables businesses to effectively understand this parameter, thereby optimizing their payment processing workflows and improving customer satisfaction.
How this parameter could benefit you?β
The previous_tran_ref
parameter can provide a more streamlined and efficient transaction management experience, benefiting your business operations.
- Enhanced Transaction Tracking: By referencing previous transactions, you can easily track and manage follow-up actions such as captures, refunds, or voids, ensuring a clear and organized transaction history.
- Improved Record-Keeping: Maintaining a link to the original transaction helps in better record-keeping, making it easier to audit and review transaction histories.
- Streamlined Operations: With the
previous_tran_ref
parameter, subsequent transactions are seamlessly connected to their original ones, reducing the complexity of managing multiple related transactions. - Versatility Across Use Cases: : Whether itβs for capturing payments, processing refunds, or handling voids, the
previous_tran_ref
parameter can be utilized across various transaction scenarios, making it a versatile tool for your business. - Reduced Operational Overhead: By automating the linkage between transactions, you can reduce the manual effort required to manage and reconcile transactions, leading to operational efficiencies.
- Better Dispute Resolution: Having a clear reference to previous transactions aids in resolving disputes more effectively, as all related transaction details are easily accessible.
Name but a few different Businesses/Industries that can benefit from this API parameter:
- E-Commerce Systems: Ensures smooth handling of returns, refunds, and exchanges.
- Hospitality: Facilitates easy management of booking modifications and cancellations.
- Subscription Services: Simplifies the process of handling subscription changes and refunds.
- Financial Services: Enhances the accuracy and efficiency of transaction processing and dispute resolution.
- Retail: Streamlines the management of post-purchase actions like refunds and exchanges.
When Will You Receive This Parameter?β
Understanding the specific scenarios in which theprevious_tran_ref
parameter is included in the response payload can help you effectively utilize it in your transaction response handling. Here are some common situations:- Capture Transactions: As clarified in theCapture manual, when a capture transaction is processed, the
previous_tran_ref
parameter is included to reference the original authorization transaction. This helps in linking the capture to its corresponding authorization. - Refund Transactions: Also as clarified in theRefund manual, during a refund process, the previous_tran_ref parameter is provided to reference the original transaction being refunded. This ensures that the refund is accurately associated with the initial payment.
- Void Transactions: As well as clarified in theVoid manual, when voiding a transaction, the
previous_tran_ref
parameter is included to reference the original transaction that is being voided. This helps in maintaining a clear transaction history. - Release Transactions: As well as clarified in theRelease manual, when releasing a partial amount from a transaction, the
previous_tran_ref
parameter is included to reference the original transaction that is being partially voided. This helps in maintaining a clear transaction history. - Recurring Transactions: As mentioned in theToken-Based Transactions manual, for recurring payment setups, the
previous_tran_ref
parameter will be included to reference the initial/main transaction that created the token in the first place, ensuring continuity and accurate tracking of subsequent payments.
How it Works?β
In order for you to understand more how theprevious_tran_ref
parameter could benefit you, you kindly need to check the below simple steps:- Capture
- Refund
- Void
- Release
- Recurring Payments
- Within the initiation of the request payload for the capture (or partially capture) follow-up transaction or what we call in Step 7, managing your transactions, you will pass the
capture
action/value into the parametertran_type
.{
.
.
"tran_type":"capture",
"cart_amount": 100,
.
.
} - Along with the request (object), you will have to pass the main/parent transaction reference, which you want to capture (or partially capture) the provided amount from, within a parameter called
tran_ref
. This of-course coming along with passing the needed other information such as the amount and so, as clarified in the below sample:{
.
.
"tran_type":"capture",
"cart_amount": 100,
"tran_ref": "TST2016700000XXX"
.
.
} - Once you post your request, you will receive a response that includes the new
tran_ref
of the new transaction created/captured, along with theprevious_tran_ref
of the main/parent transaction. This means the amount has been captured successfully from the oldprevious_tran_ref
transaction within the newtran_ref
transaction.You Should KnowTo know more about how you can receive this parameter, and what are the different ways you can receive this parameter with, you may need to check ourWhat are the Five (5) ways of receiving transaction response?{
.
.
"tran_ref": "TST2016700000XX1",
"previous_tran_ref": "TST2016700000XXX"
.
.
} - Finally, you will be able to see this new transaction connected to the main/parent transaction as well on your merchant dashboard, whether it's accepted/authorized or not.
- Within the initiation of the request payload for the refund follow-up transaction or what we call in Step 7, managing your transactions, you will pass the
refund
action/value into the parametertran_type
.{
.
.
"tran_type":"refund",
"cart_amount": 100,
.
.
} - Along with the request (object), you will have to pass the main/parent transaction reference, which you want to refund the provided amount from, within a parameter called
tran_ref
. This of-course coming along with passing the needed other information such as the amount and so, as clarified in the below sample:{
.
.
"tran_type":"refund",
"cart_amount": 100,
"tran_ref": "TST2016700000XXX"
.
.
} - Once you post your request, you will receive a response that includes the new
tran_ref
of the new transaction created/refundd, along with theprevious_tran_ref
of the main/parent transaction. This means the amount has been refundd successfully from the oldprevious_tran_ref
transaction within the newtran_ref
transaction.You Should KnowTo know more about how you can receive this parameter, and what are the different ways you can receive this parameter with, you may need to check ourWhat are the Five (5) ways of receiving transaction response?{
.
.
"tran_ref": "TST2016700000XX1",
"previous_tran_ref": "TST2016700000XXX"
.
.
} - Finally, you will be able to see this new transaction connected to the main/parent transaction as well on your merchant dashboard, whether it's accepted/authorized or not.TipOnly in your merchant dashboard view, you will see the full history of the transaction. For example, if a refund has been processed on a transaction that has been captured from an
auth
one, both of them will be displayed in the "Previous" row.
- Within the initiation of the request payload for the void follow-up transaction or what we call in Step 7, managing your transactions, you will pass the
void
action/value into the parametertran_type
.{
.
.
"tran_type":"void",
"cart_amount": 100,
.
.
} - Along with the request (object), you will have to pass the main/parent transaction reference, which you want to void, within a parameter called
tran_ref
. This of-course coming along with passing the needed other information such as the amount and so, as clarified in the below sample:Be Aware OfTo perform avoid
transaction you MUST pass the whole transaction amount. Any partial amount would be passed, the transaction will be consideredrelease
instead ofvoid
{
.
.
"tran_type":"void",
"cart_amount": 100,
"tran_ref": "TST2016700000XXX"
.
.
} - Once you post your request, you will receive a response that includes the new
tran_ref
of the new transaction created/voided, along with theprevious_tran_ref
of the main/parent transaction. This means the amount has been voided successfully from the oldprevious_tran_ref
transaction within the newtran_ref
transaction.You Should KnowTo know more about how you can receive this parameter, and what are the different ways you can receive this parameter with, you may need to check ourWhat are the Five (5) ways of receiving transaction response?{
.
.
"tran_ref": "TST2016700000XX1",
"previous_tran_ref": "TST2016700000XXX"
.
.
} - Finally, you will be able to see this new transaction connected to the main/parent transaction as well on your merchant dashboard, whether it's accepted/authorized or not.
- Within the initiation of the request payload for the release follow-up transaction or what we call in Step 7, managing your transactions, you will pass the
release
action/value into the parametertran_type
.{
.
.
"tran_type":"release",
"cart_amount": 100,
.
.
} - Along with the request (object), you will have to pass the main/parent transaction reference, which you want to release the provided amount from, within a parameter called
tran_ref
. This of-course coming along with passing the needed other information such as the amount and so, as clarified in the below sample:Be Aware OfTo perform arelease
transaction you MUST pass a partial transaction amount. If the whole amount has been passed, the transaction will be consideredvoid
instead ofrelease
{
.
.
"tran_type":"release",
"cart_amount": 100,
"tran_ref": "TST2016700000XXX"
.
.
} - Once you post your request, you will receive a response that includes the new
tran_ref
of the new transaction created/released, along with theprevious_tran_ref
of the main/parent transaction. This means the amount has been released successfully from the oldprevious_tran_ref
transaction within the newtran_ref
transaction.You Should KnowTo know more about how you can receive this parameter, and what are the different ways you can receive this parameter with, you may need to check ourWhat are the Five (5) ways of receiving transaction response?{
.
.
"tran_ref": "TST2016700000XX1",
"previous_tran_ref": "TST2016700000XXX"
.
.
} - Finally, you will be able to see this new transaction connected to the main/parent transaction as well on your merchant dashboard, whether it's accepted/authorized or not.
- Within the initiation of the request payload for the recurring payment in Step 3 - initiating the payment, via theToken-Based Transactions manual, you will need yo pass the
recurring
value in thetran_class
.{
.
.
"tran_class":"recurring",
.
.
} - Along with the request (object), you will have to pass the main/parent transaction reference, which you want to recur the payment accordingly within a parameter called
tran_ref
. This of-course coming along with passing the needed other information such as the amount and so, as clarified in the below sample:{
.
.
"tran_class":"recurring",
"cart_amount": 100,
"tran_ref": "TST2016700000XXX"
.
.
} - Once you post your request, you will receive a response that includes the new
tran_ref
of the new transaction created/recurred, along with theprevious_tran_ref
of the main/parent transaction. This means the amount has been recurred/debited successfully according to the token initiated from the oldprevious_tran_ref
transaction within the newtran_ref
transaction.You Should KnowTo know more about how you can receive this parameter, and what are the different ways you can receive this parameter with, you may need to check ourWhat are the Five (5) ways of receiving transaction response?{
.
.
"tran_ref": "TST2016700000XX1",
"previous_tran_ref": "TST2016700000XXX"
.
.
} - Finally, you will be able to see this new transaction connected to the main/parent transaction as well on your merchant dashboard, whether it's accepted/authorized or not.
Parameter Specificationsβ
previous_tran_ref
Parameter previous_tran_ref
Description the previous transactions response is the parameter that indicates the prior/main transaction related to current transaction. Data Type String Required β Sample {
"previous_tran_ref": "TST2234701408XXX"
}
Request & Response Payloads Samplesβ
- Capture
- Refund
- Void
- Release
- Recurring
The below sample request payload will show you how the above-mentioned parameter works with full code sample, along with the response payload received.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": {{profile_id}},
"tran_class": "ecom",
"tran_type": "capture",
"cart_description": "Description of the items/services",
"cart_id": "previous_tran_ref code sample Transaction",
"cart_amount": 10,
"cart_currency": "SAR",
"tran_ref": "TST2430601944066"
}
{
"tran_ref": "TST2430601944067",
"previous_tran_ref": "TST2430601944066",
"tran_type": "capture",
"cart_id": "previous_tran_ref code sample Transaction",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "10.00",
"tran_currency": "SAR",
"tran_total": "10.00",
"customer_details": {
"name": "Technical Support Operations",
"email": "[email protected]",
"street1": "Address",
"city": "Riyadh",
"state": "Riyadh",
"country": "SA",
},
"payment_result": {
"response_status": "A",
"response_code": "G81709",
"response_message": "Authorised",
"transaction_time": "2024-11-01T17:21:49Z"
},
"payment_info": {
"payment_method": "Visa",
"card_type": "Credit",
"card_scheme": "Visa",
"payment_description": "4111 11## #### 1111",
"expiryMonth": 12,
"expiryYear": 2025
},
"serviceId": 1,
"profileId": 79010,
"merchantId": 28882,
"trace": "PMNT0***.672***2D.00***81F"
}
The below sample request payload will show you how the above-mentioned parameter works with full code sample, along with the response payload received.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": {{profile_id}},
"tran_class": "ecom",
"tran_type": "refund",
"cart_description": "Description of the items/services",
"cart_id": "previous_tran_ref code sample Transaction",
"cart_amount": 10,
"cart_currency": "SAR",
"tran_ref": "TST2430601944066"
}
{
"tran_ref": "TST2430601944067",
"previous_tran_ref": "TST2430601944066",
"tran_type": "refund",
"cart_id": "previous_tran_ref code sample Transaction",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "10.00",
"tran_currency": "SAR",
"tran_total": "10.00",
"customer_details": {
"name": "Technical Support Operations",
"email": "[email protected]",
"street1": "Address",
"city": "Riyadh",
"state": "Riyadh",
"country": "SA",
},
"payment_result": {
"response_status": "A",
"response_code": "G81709",
"response_message": "Authorised",
"transaction_time": "2024-11-01T17:21:49Z"
},
"payment_info": {
"payment_method": "Visa",
"card_type": "Credit",
"card_scheme": "Visa",
"payment_description": "4111 11## #### 1111",
"expiryMonth": 12,
"expiryYear": 2025
},
"serviceId": 1,
"profileId": 79010,
"merchantId": 28882,
"trace": "PMNT0***.672***2D.00***81F"
}
The below sample request payload will show you how the above-mentioned parameter works with full code sample, along with the response payload received.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": {{profile_id}},
"tran_class": "ecom",
"tran_type": "void",
"cart_description": "Description of the items/services",
"cart_id": "previous_tran_ref code sample Transaction",
"cart_amount": 10,
"cart_currency": "SAR",
"tran_ref": "TST2430601944066"
}
{
"tran_ref": "TST2430601944067",
"previous_tran_ref": "TST2430601944066",
"tran_type": "void",
"cart_id": "previous_tran_ref code sample Transaction",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "10.00",
"tran_currency": "SAR",
"tran_total": "10.00",
"customer_details": {
"name": "Technical Support Operations",
"email": "[email protected]",
"street1": "Address",
"city": "Riyadh",
"state": "Riyadh",
"country": "SA",
},
"payment_result": {
"response_status": "A",
"response_code": "G81709",
"response_message": "Authorised",
"transaction_time": "2024-11-01T17:21:49Z"
},
"payment_info": {
"payment_method": "Visa",
"card_type": "Credit",
"card_scheme": "Visa",
"payment_description": "4111 11## #### 1111",
"expiryMonth": 12,
"expiryYear": 2025
},
"serviceId": 1,
"profileId": 79010,
"merchantId": 28882,
"trace": "PMNT0***.672***2D.00***81F"
}
The below sample request payload will show you how the above-mentioned parameter works with full code sample, along with the response payload received.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": {{profile_id}},
"tran_class": "ecom",
"tran_type": "release",
"cart_description": "Description of the items/services",
"cart_id": "previous_tran_ref code sample Transaction",
"cart_amount": 10,
"cart_currency": "SAR",
"tran_ref": "TST2430601944066"
}
{
"tran_ref": "TST2430601944067",
"previous_tran_ref": "TST2430601944066",
"tran_type": "release",
"cart_id": "previous_tran_ref code sample Transaction",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "10.00",
"tran_currency": "SAR",
"tran_total": "10.00",
"customer_details": {
"name": "Technical Support Operations",
"email": "[email protected]",
"street1": "Address",
"city": "Riyadh",
"state": "Riyadh",
"country": "SA",
},
"payment_result": {
"response_status": "A",
"response_code": "G81709",
"response_message": "Authorised",
"transaction_time": "2024-11-01T17:21:49Z"
},
"payment_info": {
"payment_method": "Visa",
"card_type": "Credit",
"card_scheme": "Visa",
"payment_description": "4111 11## #### 1111",
"expiryMonth": 12,
"expiryYear": 2025
},
"serviceId": 1,
"profileId": 79010,
"merchantId": 28882,
"trace": "PMNT0***.672***2D.00***81F"
}
The below sample request payload will show you how the above-mentioned parameter works with full code sample, along with the response payload received.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": {{profile_id}},
"tran_class": "recurring",
"tran_type": "sale",
"cart_description": "Description of the items/services",
"cart_id": "previous_tran_ref code sample Transaction",
"cart_amount": 10,
"cart_currency": "SAR",
"tran_ref": "TST2430601944066",
"token": "2***53BC***3E43***B09***6C87***0"
}
{
"tran_ref": "TST2410901857192",
"previous_tran_ref": "TST2430601944066",
"merchant_id": 28882,
"profile_id": 79010,
"cart_id": "previous_tran_ref code sample Transaction",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "10.00",
"tran_currency": "SAR",
"tran_total": "10.00",
"tran_type": "Sale",
"tran_class": "C/Auth",
"customer_details": {
"name": "Technical Support Operations",
"email": "[email protected]",
"street1": "Address",
"city": "Riyadh",
"state": "Riyadh",
"country": "SA",
},
"payment_result": {
"response_status": "A",
"response_code": "236974",
"response_message": "Authorised",
"acquirer_message": "00:Approved",
"acquirer_rrn": "410917236974",
"cvv_result": "P",
"avs_result": "P",
"transaction_time": "2024-04-18T17:07:48Z"
},
"payment_info": {
"payment_method": "Visa",
"card_type": "Credit",
"card_scheme": "Visa",
"payment_description": "4111 11## #### 1111",
"expiryMonth": 12,
"expiryYear": 2024
},
"token": "2***53BC***3E43***B09***6C87***0",
"trace": "PMNT0***.672***2D.00***81F"
}
Expected Payment Flow Behaviorβ
This parameter behaving the same regardless of the integration type you are using.
- All Integration Types
- As mentioned above in the How it works? section, As a merchant you would receive a payment response in one of the above When Will You Receive This Parameter?, same as the sample codes mentioned in the samples section above.
- As, all of the scenario cases of this parameter are direct payments/actions, which means no customer interference needed here. Therefore, you will receive a direct response that includes both, this parameter, and the payment response. This means you have initiated a correct payment request/order successfully.You Should KnowTo know more about how you can receive this parameter, and what are the different ways you can receive this parameter with, you may need to check ourWhat are the Five (5) ways of receiving transaction response?
- Finally, by this time, you will be able to see his transaction on your merchant dashboard, whether it's accepted/authorized or not.