Skip to main content

Manage Token Based transactions

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 the clarification of the SendToken. SendToken that indicates Tokenization. Only if the card has been tokenized (have a token created representing this card) the card token would be returned within the response The following parameters are required to be sent within the sendToken function as shown below:




Method Specification


Description

All you make a toke based transaction

Since1.0.0
Required

Signature

sendToken(string $tran_ref, string $token)

Sample

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




Method Parameters:


Tran Ref

Name$tran_ref
Type

STRING

DescriptiontransactionTo send the related transaction reference after tokenizing.
Default

-

Required



Token

Name$token
Type

STRING

DescriptionTo send the related Token after tokenizing.
Default

-

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, after generating the payment page use the result to redirect the customer to the payment page.
    try {
    $paymentPage = paypage::sendTransaction('sale','ecom')
    ->sendCart("Order_101", 1000.00, 'Order Description')
    ->sendToken("TST2234701408580", "JfN1DVw6w7hrM7mm1P11jNMbzFFAe9WU")
    ->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.