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 pass the cart information within the initiation of the payment page. The following string values can be passed within the "cart_details" array, which is passed as the third parameter to the "createPaymentPage" function, as shown below:
let cart = { id: "100001", currency: "EGP", amount: "550", description: "dummy description" }; let cart_details = [ cart.id, cart.currency, cart.amount, cart.description ]; paytabs.createPaymentPage( paymentMethods, transaction_details, cart_details, // array expected customer_details, shipping_address, response_URLs, lang, paymentPageCreated );
This "sendCart" parameter is Mandatory, not passing it would throw an exception.
Cart ID
The Parameter Tag/Name | cart_id |
Data Type | STRING |
Purpose | Indicates the cart/order id at the merchant end to easily relate the transaction to |
Min | 1 |
Max | 64 |
Required | ✔ |
Cart Currency
The Parameter Tag/Name | cart_currency |
Data Type | STRING |
Purpose | Indicates the transaction currency, which the customer will be charged with. Noting that this currency must be configured first on your PayTabs account to accept payment with. |
Validation Rules | Must be in ISO Alpha-3 Format. |
Required | ✔ |
The passed currency MUST be witin the configured one on your PayTabs profile which will be displayed to you in the "Profile" menu in your PayTabs dashbaord.
Cart Amount
The Parameter Tag/Name | cart_amount |
Data Type | DECIMAL |
Purpose | Indicates the amount the customer is about to be charged with. Both min and max values are subjected to the merchant transaction limits |
Min | 0.01 |
Max | 9999999999.99 |
Required | ✔ |
Cart Description
The Parameter Tag/Name | cart_description |
Data Type | STRING |
Purpose | Indicates the cart/order description at the merchant end to easily relate the transaction to. |
Min | 1 |
Max | 128 |
Required | ✔ |
⌂ 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.