Skip to main content

Request/Response: Transaction Class (tran_class)

The tran_class is one of the required parameters that you must use while initiating a hosted payment page. It defines the category or class of a transaction, like ecom or recurring. This classification helps merchants process transactions according to their business model.


Why You Should Use This Parameter​

This is one of the required parameters used to validate your API requests to PayTabs, not using this parameter correctly will result in your payment being rejected or initiated with a class different from what your business need.

You Should Know
You should know that PayTabs supports two transaction classes that you can learn more about in ourWhat is the "tran_class" (transaction class)?solution article.


Parameter Specifications​

Parametertran_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 TypeSTRING
Required✔
Validation Rules

Valid string from this list

ecom recurring moto
Sample
{
"tran_class": "ecom"
}


Sample Request & Response Payloads​

Click to view the full Request Payload!
{
"profile_id": "987###",
"tran_type": "sale",
"tran_class": "ecom",
"cart_id": "CART#1001",
"cart_currency": "SAR",
"cart_amount": 500,
"cart_description": "Description of the items/services",
}
Click to view the full Response Payload!
{
"tran_ref": "TST22********159",
"tran_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.sa/payment/page/599458B182E5B6B********************B4817FD44318539688688",
"serviceId": 2,
"profileId": 987###,
"merchantId": 1*****7,
"trace": "PMN****4.63****A8.00****C4"
}


Expected behavior​

  1. You will initiate a payment request using the guide mentioned here

  2. You will use the "tran_class" parameter according to the above Specifications

  3. Then you will receive the response payload containing the "redirect_url" meaning you have initiated a correct payment request.

  4. Finally, you should redirect your customer to this URL so the payment process can be finalized.