Skip to main content

Transaction Class (tran_class)

Warning

This parameter ONLY working with those integration types (Hosted Payment Page, Managed Form, and Own Form)).

In the evolving landscape of online payments, flexibility and user-centric options are paramount. In PayTabs integrations, the tran_class parameter is used to define how a transaction is processed. It supports multiple values that enable transactions to be handled as standard e-commerce payments, recurring transactions, or MOTO (Mail Order / Telephone Order) transactions, depending on the business requirement.

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:
    Setting tran_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:
    Setting tran_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.

  • Using the Moto value:
    Setting tran_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.
    Note:
    • 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.

Name but a few different Businesses/Industries that can benefit from this API parameter:

  • E‑Commerce Merchants: Use tran_class to process standard online card transactions as regular e-commerce payments.

  • Subscription-Based Services: Supports recurring transactions for services such as SaaS platforms, streaming services, and digital memberships.

  • Retail and Point of Sale (POS): Enables classification of transactions initiated through different sales channels, including remote or delayed payments.

  • Hospitality and Travel: Hotels and travel agencies can usetran_class for recurring transactions such as bookings, deposits, or offline customer confirmations.

  • Education and Training Platforms: Enables recurring billing for course fees, training subscriptions, or installment-based payments.

  • Utilities and Service Providers: Supports recurring or scheduled payments for services such as telecom, internet, or maintenance contracts.

  • Insurance and Financial Services: Used to distinguish recurring premiums, customer-initiated payments, or automatic processed transactions.

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 a redirect_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
    DescriptionThe 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"
    }

Request & Response Payloads Samples

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.

{
"profile_id": 83061,
"tran_type": "sale",
"tran_class": "ecom",
"cart_id": "CART#10001",
"cart_currency": "SAR",
"cart_amount": 200,
"cart_description": "Cart Description"
}


Expected Payment Flow Behavior


  1. 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 value ecom within the tran_class parameter.

  2. Then, you will receive a response that includes the same tran_class you passed in the request payload, along with the redirect URL. This means you have initiated a correct payment request/page successfully.

    {
    .
    "tran_class": "ecom",
    "redirect_url": "https://secure.paytabs.com/payment/page/52E5B*********B4818688",
    .
    }

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

  4. After this, your customer would proceed normally with payment by choosing the preferred payment method (if available), and providing his card information.

    Payment Page

  5. Then, he will be redirected to his issuer bank 3DS/OTP page to authenticate the used card

  6. 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.transaction view

    transaction view

We are glad to be always in help. We aim to serve you better each time. As such, please spare a minute to share feedback about your recent experience with PayTabs Developers , on Trustpilot, or Google Reviews.