Skip to main content

Manage the Transaction Type

PayTabs provides you with the backend packages that make the integrating with PayTabs payment gateway very easy by providing ready-made classes that handle the payment process.

This article is dedicated to walking you through how to manage how to initiate a payment request with a specific transaction type. The following transaction type keys can be sent within the sendTransaction function as shown below:

Info

Through out the article we will use the transaction types clarified in our What is the "tran_type" (transaction type)? solution article.




Method Specification


Be Aware

That the sendTransaction method is Mandatory, not passing it would throw an exception.

Description

Responsible of sending the the transaction type and class.

Since1.0.0
Required

Signature

sendTransaction(string $tran_type, string $tran_class)

Sample

paypage::sendTransaction('sale','ecom')
->sendCart("Order_101", 1000.00, 'Order Description')
->create_pay_page();




Method Parameters:


Tran Type

Name$tran_type
Type

enum

Enum values
sale

This means that the amount of the transaction will be deducted directly from the customer's bank account once he submits the purchase, and it will be transferred to the acquirer's bank account.

auth

This means the amount of the purchase will be deducted from the cardholder's bank account, yet it will be held (authorized) for a certain period of time/days, differing from one issuer bank to another. This amount will remain at the cardholder bank until it gets captured. In other words, it will not be transferred to the acquirer's bank account until it gets captured from your side; otherwise, it will be voided back to the customer.

Description

The identification of the type of the transaction.

Default

-

Validation Rule

Accept sale or auth

Required



Tran Class

Name$tran_class
Type

enum

Enum values
ecom

The initial request to create any payment page should be with class "ecom", which indicates to eCommerce.

recurring

Tokenization is the process of protecting sensitive data by replacing it with an algorithmically generated number called a token. This can be used to allow returning customers to purchase without re-entering credit card details (recurring) such as monthly subscription fees.

Description

The identification of the class of the transaction.

Default

ecom

Validation Rule

Accept ecom or recurring

Required




Expected payment flow behaviour:


  1. As a merchant you would initiate a payment request per the above Specifications, which include a sample code.

  2. Then, you will call the method create_pay_page() and return the result to redirect the customer to the payment page.

    try {
    $paymentPage = paypage::sendTransaction('sale','ecom')
    ->sendCart("Order_101", 1000.00, 'Order Description')
    ->create_pay_page();

    return $paymentPage;

    } catch (\Exception $e) {
    // Handle errors appropriately
    return back()->with('error', 'Payment initiation failed: ' . $e->getMessage());
    }

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

    Payment Page

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

  5. 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.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.