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 and pass the return and the callback URLs . The following string values can be passed within the "response_URLs " array, which is passed as the sixth parameter to the "createPaymentPage" function, as shown below:


let url = {
    callback:"https://elrayesdev.com/api/callback",
    response:"https://elrayesdev.com/response/order/"+cart.id
}

let response_URLs = [
    url.callback,
    url.response
];

paytabs.createPaymentPage(
    paymentMethods,
    transaction_details,
    cart_details,
    customer_details,
    shipping_address,
    response_URLs,                // URLs array
    lang,
    paymentPageCreated
);


This "response_URLs" parameter is Mandatory, not passing it would throw an exception.



Return


The Parameter Tag/Namereturn
Data TypeSTRING
Validation Rules
Valid URL
Purpose
The return URL is the URL that PayTabs will redirect the customer to after he finishes the payment process (whether it's authenticated or not). It will redirect the customer with a POST response that is sent with the client/cardholder redirection through his browser containing the basic transaction information once the payment process ends (whether the customer cancels, paid, or failed to pay). It depends on the customer's actions, which means if the customer closes the browser right after the payment without waiting to be redirected back to your system, you will not receive this response. 
 
What is the Return URL vs the Callback URL?  
Min
-
Max255
Required


 

Callback


The Parameter Tag/Namecallback
Data TypeSTRING
Validation Rules
Valid URL
Purpose

The callback response is a server-to-server POST response that is sent (to a pre-defined HTTPS URL) with the full detailed transaction information once the payment process has ended (whether the customer cancels, paid, or failed to pay). It does not depend on the customer's actions; the response will be sent anyway. 

Min
-
Max255
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.