Transaction Class (tran_class)
This parameter ONLY working with those integration types (Hosted Payment Page, Managed Form, and Own Form)).
The Transaction Class parameter is one of the required parameters that you must use while initiating any payment request. It identifies the class of transaction being processed, such as Ecom, Moto, and Recurring. This classification ensures that each transaction is handled according to its specific requirements. For more information please check our What is the "tran_class" (transaction class)? solution article.Not using this parameter correctly will result in your payment being rejected or initiated with a class different from what your business need.
Next, we can delve into the specifics of how to implement the tran_class
parameter in your requests.
How this parameter could benefit you?​
Here are some scenarios to help you understand when to use the Transaction Class parameter:
- Allow you to use the recurring transactions: The "Recurring" allow returning customers to purchase without re-entering credit card details (recurring) such as monthly subscriptions fees. However, this required to tokenize the customer bank card first through an authorized transaction.
- Improved Tracking and Reporting: By categorizing transactions with the "tran_class" parameter, businesses may find it easier to track and analyze your financial data.
- Using the Ecom value:
Settingtran_class
to "ecom" offers these benefits:- Indicates an eCommerce transaction.
- Can be used with the optional parameter "tokenise" to save a transaction token for recurring payments.
`` - Using the Recurring (Tokenization) value:
Settingtran_class
to "recurring" offers these benefits:- Allows returning customers to purchase without re-entering credit card details.
Note: The recurring (tokenization) feature must be enabled on your account (profile) before using it.
- Allows returning customers to purchase without re-entering credit card details.
- Using the Moto value:
Settingtran_class
to "moto" offers these benefits:- Allows you to process payments with "Non 3DS" and/or "Non CVV".
- Can be used if you have your client's card saved in your database.
- Allows you to process payments without 3DS for clients who don't have 3DS on their cards.
- The Moto feature must be enabled on your account (profile) before using it.
- TThe Moto feature only works with the "Own Form" request.
- TPCI DSS certification to a minimum of SAQ-D is required to enable the Moto feature.
Limitations​
- Profile configuration: For example your profile must configured to accept recurring to use it.
How to Use?​
In order for you to start use the tran_class
parameter, you kindly need to follow the below simple steps:
- Within the initiation of the request payload of the payment page/invoice in Step 3 via any of the supported integration types by this parameter, you will use the mandatory parameter
tran_class
within the main request payload itself as shown below:{
...
"tran_class": "Ecom"
....
} - Once you post your request, for the type
Ecom
you will receive aredirect_url
that you will need to direct the customer to complete the payment process:{
...
"redirect_url": "https://secure.paytabs.com/payment/page/599458B182E5B6B********************B4818688",
....
} - Finally some transactions type are direct transactions that don't need any further payment process and other will need to you to redirect the customer to a page for either authenticate the cardholder via the 3D Secure or processed with asking to fill the bank card details within the payment page. You may need to check his customer experience after in the coming Expected Payment Flow Behavior.
Parameter Specifications​
-
tran_class
Parameter tran_class
Description The identification of the category/class this transaction will follow, such as eCommerce, Recurring, etc. To know more about these types please check our What is the "tran_class" (transaction class)? solution article.
To know more about this parameter please click here.Data Type STRING Required ✔ Validation Rules Valid string from this list
ecom
recurring
moto
Sample {
"tran_class": "ecom"
}
Request & Response Payloads Samples​
- Hosted Payment Page
- Managed
- Own
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": "9*****4",
"cart_type": "sale",
"tran_class": "ecom",
"cart_description": "CART#1001",
"cart_id": "Unique order reference00",
"cart_amount": 25000.2,
"cart_currency": "SAR"
}
{
"tran_ref": "TST22********159",
"cart_type": "Sale",
"cart_id": "CART#1001",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "500.00",
"return": "none",
"redirect_url": "https://secure.paytabs.com/payment/page/599458B182E5B6B********************B4817FD44318539688688",
"serviceId": 2,
"profileId": 9*****4,
"merchantId": 1*****7,
"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"
},
"payment_token": "Dh4r8Jwt7x6tPMVzKgtk"
}
{
"tran_ref": "TST22********159",
"cart_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": 9*****4,
"merchantId": 1*****7,
"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",
"cart_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": 9*****4,
"merchantId": 1*****7,
"trace": "PMN****4.63****A8.00****C4"
}
Expected Payment Flow Behavior​
- Hosted Payment Page
- Invoices
- 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.
be aware ofyou cannot pass card_amount and card_percentage parameters together inside the card_discount object, only one of them will be applied, I added it in the How To Use section for showing all the fields - Then, you will receive a response that includes redirect URL. This means you have initiated a correct payment request/page successfully.
"redirect_url": "https://secure.paytabs.com/payment/page/599458B182E5B6B********************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 providing his card information, and he will be able to see both the original and the alternative currency as shown below:
- 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. By this time, you will be able to see his transaction on your merchant dashboard, whether it's accepted/authorized or not.
- 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.
be aware ofyou cannot pass card_amount and card_percentage parameters together inside the card_discount object, only one of them will be applied, I added it in the How To Use section for showing all the fields - Then, you will receive a response that includes redirect URL. This means you have initiated a correct payment request/page successfully.
"redirect_url": "https://secure.paytabs.com/payment/page/599458B182E5B6B********************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 providing his card information, and he will be able to see both the original and the alternative currency as shown below:
- 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. By this time, you will be able to see his transaction on your merchant dashboard, whether it's accepted/authorized or not.