PayTabs Node.js Package makes integration with the PayTabs payment gateway very easy by providing a ready-made payment class that handles the card entry, and billing & shipping information and completes the missing details.


This article is dedicated to walking you through how to manage the callable function to receive the PayTabs sent response for your initiated payment request. You can initiate a function in which you will handle the sent payment response according to your business needs and pass it as the "paymentPageCreated" parameter, which is passed as the eighth parameter to the "createPaymentPage" function, as shown below:


paymentPageCreated = function ($results) {
    console.log($results);
}

paytabs.createPaymentPage(
    paymentMethods,
    transaction_details,
    cart_details,
    customer_details,
    shipping_address,
    response_URLs,
    lang,
    paymentPageCreated,      // callable function 
    frameMode
);


Sample Success Payment Response Payload


{
  tran_ref: 'TST22********779',
  tran_type: 'Sale',
  cart_id: '100001',
  cart_description: 'dummy description',
  cart_currency: 'EGP',
  cart_amount: '550.00',
  callback: 'https://elrayesdev.com/response/order/100001',
  return: 'https://elrayesdev.com/api/callback',
  redirect_url: 'https://secure-egypt.paytabs.com/payment/page/59A5922C82E4********************E84D67C9FE177E724F2DD4A',
  customer_details: {
    name: 'Mohammed ELRayes',
    email: '[email protected]',
    phone: '+201234567890',
    street1: 'dummy street',
    city: 'Port Fouad',
    state: 'PTS',
    country: 'EG',
    zip: '42121',
    ip: '156.221.113.117'
  },
  shipping_details: {
    name: 'Mohammed ELRayes',
    email: '[email protected]',
    phone: '+201234567890',
    street1: 'dummy street',
    city: 'Port Fouad',
    state: 'PTS',
    country: 'EG',
    zip: '42121'
  },
  serviceId: 2,
  profileId: 81784,
  merchantId: 31237,
  trace: 'PMNT0**0.63****34.00****25'
}

Sample Error Response Payload

{ 'response_code:': 400, result: undefined }








⌂ To get familiar with the whole process and the other steps, kindly navigate to our "The Node.js Packge Integration Manual" solution article. 
		
        
And to get familiar with the rest of the steps regarding the previous step
"Step 2 - Configure the integration method" kindly click here.

And to get familiar with the rest of the steps regarding the current step "Step 3 - Initiating the payment" click here.

 And to navigate to the next step in the integration process "Step 4 - Accepting the payment" kindly click here.