Request/Response: Transaction Type (tran_type)
This parameter ONLY working with those integration types (Hosted Payment Page, Managed Form, Own Form, and Invoices).
In the evolving landscape of online payments, clarity and precision are essential. PayTabs introduces the tran_type
parameter, one of the required/must parameters & designed to streamline and specify transaction types for users. This feature allows merchants to define the nature of each transaction, ensuring a seamless and accurate payment process.
Instead of a generic transaction process, the tran_type
parameter enables merchants to categorize transactions as sale, authorization, capture, or refund. This categorization provides clarity and control over the payment flow, enhancing the overall transaction experience.
To know more about our supported different transaction types, you may need to check our What is the "tran_type" (transaction type)? solution article.
tran_type
, businesses can effectively integrate this feature to cater to their operational needs and improve transaction management.How this parameter could benefit you?​
The tran_type
parameter is essential for defining the nature of each transaction, and its benefits are substantial:
- Enhanced Transaction Clarity: By specifying the transaction type (e.g., sale, authorization, capture, or refund), you can ensure that each transaction is processed correctly and efficiently. This clarity helps in reducing errors and misunderstandings.
- Improved Financial Management: With clear transaction types, your financial records become more organized. This makes it easier to track and reconcile transactions, leading to better financial management and reporting.
- Streamlined Operation: The
tran_type
parameter allows for streamlined operations by categorizing transactions appropriately. This helps in automating processes and reducing manual intervention, saving time and resources. - Increased Security: By defining transaction types, you can implement specific security measures for each type. For example, authorizations can have different security protocols compared to refunds, enhancing overall transaction security.
- Regulatory Compliance: Properly categorizing transactions helps in maintaining compliance with financial regulations and standards. This reduces the risk of non-compliance and potential penalties.
Name but a few different Businesses/Industries that can benefit from this API parameter:
- Retail and E-commerce: Online stores can use the
tran_type
parameter to manage sales, authorizations, captures, and refunds efficiently, ensuring smooth and accurate transaction processing for various product categories and customer segments. - Hospitality and Travel: Hotels, airlines, and travel agencies can benefit by categorizing transactions for bookings, cancellations, and refunds. This helps in maintaining clear records and providing a seamless experience for travelers.
- Subscription Services: Companies offering subscription-based models, such as streaming services or software providers, can use different transaction types to handle initial payments, recurring charges, and refunds, enhancing customer satisfaction and operational efficiency.
- Healthcare Services: Clinics, hospitals, and other healthcare providers can manage payments for consultations, treatments, and refunds by categorizing transactions appropriately, ensuring accurate billing and financial management.
- Education and Training: Educational institutions and training centers can use the tran_type parameter to handle payments for tuition, course materials, and refunds, providing a clear and organized payment process for students and parents.
- Event Management: Event organizers can benefit by categorizing transactions for ticket sales, sponsorships, and refunds, ensuring a smooth and organized payment process for various events and activities.
- Non-Profit Organizations: Charities and non-profits can manage donations, event registrations, and refunds by using different transaction types, making it easier to track and manage contributions.
Limitations​
- Mandatory Inclusion: This parameter must be included in every payment creation request. Omitting this parameter will result in the failure of the request.
- Duplicate Request Error: If the same details (
cart_id
,cart_amount
,cart_currency
,profile_id
) are duplicated within less than 2 minutes, it will cause a duplicate request error. This is a safeguard to prevent accidental double charges or duplicate transactions. - Profile-Specific Configuration: The types of transactions available are limited to those configured in the merchant's profile. This means that if a specific transaction type is not set up in your profile, it cannot be used.
- Acquirer Bank Support: Not all transaction types are supported by every acquiring bank. Some banks may have restrictions on certain types of transactions, such as authorizations or refunds. It's important to verify with your acquiring bank which transaction types are supported.
- Regulatory Restrictions: Certain transaction types may be subject to regulatory restrictions or requirements, depending on the region or industry. Compliance with these regulations is essential to avoid legal issues.
How to Use?​
In order for you to start use thetran_type
parameter, you kindly need to follow the below simple steps.As each different transaction type would have a different payment behavior, you will find two different casinos the
DIRECT
, in which payment flow no customer engagement is needed, and the Engaging
one which requires a customer engagement to complete the payment process.- Engaging Transaction Types
- Direct Transaction Types
sale
auth
register
. Below, is how this parameter is gonna used over these types:- Within the initiation of the request payload of the payment page as mentioned in Step 3 via regardless the integration types, you will MUST use the mandatory parameter
tran_type
within the main request payload itself as shown below. You need also to ensure that all required parameters are included and correctly formatted.{
...
"tran_type": "sale"
....
} - Once you post your request, you will receive a response that includes the
tran_type
as well:WarningOnly in "Invoices" integration type (via the invoice endpoint), you will NOT receive the
tran_type
in the response, as mentioned in theInvoices - Step 3 | Initiate the payment manual.{
...
"tran_type": "sale"
....
} - Depending on the integration type and the request, not within all the transaction types' life cycle, you will will need to redirect the customer to the payment page or any other external links for either authenticate the cardholder via the 3D Secure or other needed actions.
You may need to check his customer experience after in the coming Expected Payment Flow Behavior.
refund
void
release
capture
. Below, is how this parameter is gonna used over these types:- Within the initiation of the request payload regardless of the follow-up transaction type or what we call in Step 7, managing your transactions, you will pass the requested action/value into the parameter
tran_type
.{
...
"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 transaction type has been performed/processed successfully on the oldprevious_tran_ref
transaction and a newtran_ref
transaction has been created.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_type":"capture",
"tran_ref": "TST2016700000XX1",
"previous_tran_ref": "TST2016700000XXX"
.
.
}
Parameter Specifications​
-
tran_type
Parameter tran_type
Description The identification of the type of the transaction. To know more about these types please check our What is the "tran_type" (transaction type)? solution article.
To know more about this parameter please click here.Data Type INT Required ✔ Validation Rules Valid string from this enum list:
sale
auth
void
release
capture
refund
register
Sample {
"tran_type": "sale"
}
Request & Response Payloads Samples​
- Hosted Payment Page
- Invoices
- Managed Form
- Own Form
The below sample request payload will show you how you can pass the above-mentioned required parameter, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": "79010",
"tran_type": "sale",
"tran_class": "ecom",
"cart_id": "cart_1",
"cart_currency": "SAR",
"cart_amount": 12.3,
"cart_description": "Description of the items/services",
"paypage_lang": "en",
"customer_details": {
"name": "FirstName LastName",
"email": "[email protected]",
"phone": "9771555555555",
"street1": "street2",
"city": "dubai",
"state": "dubai",
"country": "AE",
"zip": "54321"
},
"shipping_details": {
"name": "FirstName LastName",
"email": "[email protected]",
"phone": "971555555555",
"street1": "street2",
"city": "dubai",
"state": "dubai",
"country": "AE",
"zip": "54321"
}
}
{
"tran_ref": "TST22********159",
"tran_type": "sale",
"cart_id": "cart_1",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "12.30",
"tran_total": "0",
"return": "none",
"redirect_url": "https://secure.paytabs.com/payment/wr/5DBXXX4F5BB9C2EXXXX8249E75E3D4D8C84",
"customer_details": {
"name": "FirstName LastName",
"email": "[email protected]",
"phone": "971555555555",
"street1": "street2",
"city": "dubai",
"state": "dubai",
"country": "AE",
"zip": "54321"
},
"shipping_details": {
"name": "FirstName LastName",
"email": "[email protected]",
"phone": "971555555555",
"street1": "street2",
"city": "dubai",
"state": "dubai",
"country": "AE",
"zip": "54321"
},
"serviceId": 2,
"profileId": "79010",
"merchantId": 43796,
"trace": "PMN****4.63****A8.00****C4"
}
The below sample request payload will show you how you can pass the above-mentioned required parameter, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
Only in "Invoices" integration type (via the invoice endpoint), you will NOT receive the tran_type
in the response, as mentioned in theInvoices - Step 3 | Initiate the payment manual.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": "79010",
"tran_type": "sale",
"tran_class": "ecom",
"cart_description": "Description of the items/services",
"cart_id": "Unique order reference00",
"cart_amount": 200,
"cart_currency": "SAR",
"invoice": {
"line_items": [
{
"unit_cost": 100,
"quantity":2
}
]
}
}
{
"tran_ref": "TST22********159",
"tran_type": "Sale",
"cart_id": "Unique order reference00",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "200.00",
"tran_total": "0",
"return": "none",
"redirect_url": "https://secure.paytabs.com/payment/wr/5DB410*******9762FE9DBA2",
"invoice": {
"id": 3123814,
"shipping_charges": "0",
"extra_charges": "0",
"extra_discount": "0",
"total": "200",
"activation_date": 0,
"expiry_date": 0,
"due_date": 0,
"issue_date": 1732761054,
"line_items": [
{
"unit_cost": "100",
"quantity": "2",
"net_total": "200",
"discount_rate": "0",
"discount_amount": "0",
"tax_rate": "0",
"tax_total": "0",
"total": "200"
}
]
},
"serviceId": 2,
"profileId": "79010",
"merchantId": 28882,
"trace": "PMN****4.63****A8.00****C4"
}
The below sample request payload will show you how you can pass the above-mentioned required parameter, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": "79010",
"tran_type": "sale",
"tran_class": "ecom",
"cart_id": "CART#1001",
"cart_currency": "SAR",
"cart_amount": 9.5,
"cart_description": "Description of the items/services",
"customer_details":
{
"name": "FirstName LastName",
"email": "[email protected]",
"phone": "971555555555",
"street1": "street2",
"city": "dubai",
"state": "dubai",
"country": "AE",
"zip": "54321"
},
"payment_token": "Dh4r8Jw*******zKgtk"
}
{
"tran_ref": "TST22********159",
"tran_type": "Sale",
"cart_id": "CART#1001",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "9.5",
"return": "none",
"redirect_url": "https://secure.paytabs.com/payment/page/599458B182E5B6B********************B4817FD44318539688688",
"serviceId": 2,
"profileId": "79010",
"merchantId": 28882,
"trace": "PMN****4.63****A8.00****C4"
}
The below sample request payload will show you how you can pass the above-mentioned required parameter, which are needed to be passed with valid values to perform a request. Along with the response payload received after using this request payload.
- Request Sample Payload
- Response Sample Payload
{
"profile_id": "9xxx4",
"tran_type": "sale",
"tran_class": "ecom",
"cart_id": "CART#1001",
"cart_currency": "SAR",
"cart_amount": 9.5,
"cart_description": "Description of the items/services",
"customer_details":
{
"name": "Technical Support Team",
"email": "[email protected]",
"phone": "+201234567890",
"street1": "address street",
"city": "Cairo",
"state": "CAI",
"country": "EG",
"zip": "45555",
"ip": "1.1.1.1"
},
"card_details": {
"pan": "4111111111111111",
"cvv": "123",
"expiry_month": 12,
"expiry_year": 2023
}
}
{
"tran_ref": "TST22********159",
"tran_type": "Sale",
"cart_id": "CART#1001",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "9.5",
"return": "none",
"redirect_url": "https://secure.paytabs.com/payment/page/599458B182E5B6B********************B4817FD44318539688688",
"customer_details":
{
"name": "Technical Support Team",
"email": "[email protected]",
"phone": "+201234567890",
"street1": "address street",
"city": "Cairo",
"state": "CAI",
"country": "EG",
"zip": "45555",
"ip": "1.1.1.1"
},
"serviceId": 2,
"profileId": "79010",
"merchantId": 28882,
"trace": "PMN****4.63****A8.00****C4"
}
Expected Payment Flow Behavior​
- All Integration Types
As each different transaction type would have a different payment behavior, you will find two tags DIRECT
which indicates that this a direct payment flow no customer engagement is needed, and the Engaging
for the other, that requires a customer engagement. Below will show you the payment flow for each:
- Sale
- Auth
- Capture
- Void
- Release
- Refund
- Register
Engaging
- As mentioned above in the How to use? section, As a merchant you would initiate a payment request per the above Specifications, same as the sample codes mentioned in the samples section above.
However, you will need to pass the valuesale
within thetran_type
parameter. - Then, you will receive a response that includes the same
tran_type
you passed in the request payload, along with the redirect URL. This means you have initiated a correct payment request/page successfully.{
.
"tran_type": "sale",
.
"redirect_url": "https://secure.paytabs.com/payment/page/52E5B*********B4818688",
.
.
} - Next, you should redirect your customer to this URL so the payment process can be finalized.
- After this, your customer would proceed normally with payment by choosing the preferred payment method (if available), and providing his card information.
- Then, he will be redirected to his issuer bank 3DS/OTP page to authenticate the used card
- Finally, he would be redirect to a success/error page accordingly. Once he had a successful payment, the payment amount will be directly charged from his issuer bank account and transferred to the acquirer bank account accordingly.
By this time, you will be able to see his transaction on your merchant dashboard, whether it's accepted/authorized or not.
Engaging
- As mentioned above in the How to use? section, As a merchant you would initiate a payment request per the above Specifications, same as the sample codes mentioned in the samples section above.
However, you will need to pass the valueauth
within thetran_type
parameter. - Then, you will receive a response that includes the same
auth
you passed in the request payload, along with the redirect URL. This means you have initiated a correct payment request/page successfully.{
.
"tran_type": "auth",
.
"redirect_url": "https://secure.paytabs.com/payment/page/52E5B6B*************B4818688",
.
.
} - Next, you should redirect your customer to this URL so the payment process can be finalized.
- After this, your customer would proceed normally with payment by choosing the preferred payment method (if available), and providing his card information.
- Then, he will be redirected to his issuer bank 3DS/OTP page to authenticate the used card
- Finally, he would be redirect to a success/error page accordingly. Once he had a successful payment, the payment amount will be reserved from his issuer bank account and will be on hold at the issuer bank side. Some issuer banks will sent a deduction SMS to the customer although the amount held on their side yet.
By this time, you will be able to see his transaction on your merchant dashboard, whether it's accepted/authorized or not.
DIRECT
- As mentioned above in the How to use? section, As a merchant you would initiate a payment request per the above Specifications, same as the sample codes mentioned in the samples section above.
- This means, that 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
tran_ref
of the main/parent transaction reference, which you want to capture (or partially capture) the provided amount from, within a parameter calledtran_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.
DIRECT
- As mentioned above in the How to use? section, As a merchant you would initiate a payment request per the above Specifications, same as the sample codes mentioned in the samples section above.
- This means, that 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.
DIRECT
- As mentioned above in the How to use? section, As a merchant you would initiate a payment request per the above Specifications, same as the sample codes mentioned in the samples section above.
- This means, that 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.
DIRECT
- As mentioned above in the How to use? section, As a merchant you would initiate a payment request per the above Specifications, same as the sample codes mentioned in the samples section above.
- This means, that 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.
Engaging
- As mentioned above in the How to use? section, As a merchant you would initiate a payment request per the above Specifications, same as the sample codes mentioned in the samples section above.
However, you will need to pass the valueregister
within thetran_type
parameter. - Then, you will receive a response that includes the same
register
you passed in the request payload, along with the redirect URL. This means you have initiated a correct payment request/page successfully.{
.
"tran_type": "register",
.
"redirect_url": "https://secure.paytabs.com/payment/page/52E5B6B*************B4818688",
.
.
} - Next, you should redirect your customer to this URL so the payment process can be finalized.
- After this, your customer would have a payment page as shown below, and would proceed normally with payment by choosing the preferred payment method (if available), and providing his card information.
- Then, he will be redirected to his issuer bank 3DS/OTP page to authenticate the used card
- Finally, he would be redirect to a success/error page accordingly. Once he had a successful payment, the payment amount will be reserved from his issuer bank account, then voided directly back to the customer account again.
By this time, you will be able to see his transaction on your merchant dashboard, whether it's accepted/authorized or not.