Paytabs provides you with a collection of API endpoints which used to process all payments, regardless of if they are through either your own payment pages, the managed payment pages, or if you are using the hosted payment pages.
This article is dedicated to walking you through how to handle the payment response sent from PayTabs after the payment. Handling the response right will empower you to make sure to handle the user experience according to the payment status, as well as and updating the order status in your database.
In this article, we will walk you through the following:
- via The IPN Response
- via The Callback URL Response
- Response Payload Specifications
- Verify the IPN/Callback Response
via The IPN Response
The Instant Payment Notification (IPN) is the payment status notification to the configured URL, and it is a pure server-to-server connection (i.e.: It is not a browser-based request).
As soon as a transaction is created or altered, IPN will instantly send a notification to the merchant’s specified IPN Listener URL with the full detailed transaction information response, which can have any code that will assist in updating ERP or dependent systems. Alternatively, you may wish to save this information in your local database.
To get the best out of this, it's highly recommended to check our How to configure Instant payment notification (IPN) solution article.
What you need to do is to manage the Callback URL, and for that, you need to check our Request/Response - The Callback URL solution article. The next main step would be to receive this [POST] response and handle it according to your business needs. Response_status and response_message can be much helpful in knowing exactly what is the transaction status. Also, you can check our Response_code and Response_status solution article for more details.
You should know that since the request is coming from an external system, the CSRF token needs to be excepted.
via The Callback URL Response
The callback response, which is a one-time IPN, 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 comes to an end (whether the customer cancels, pays, or fails to pay), as shown below. It doesn't depend on the customer's actions, and the response will be sent anyway.
Since it's a server-to-server call, the callback URL MIUST be an available, accessible, and public URL
What you need to do is to manage the Callback URL, and for that, you need to check our Request/Response - The Callback URL solution article. The next main step would be to receive this [POST] response and handle it according to your business needs. Response_status and response_message can be much helpful in knowing exactly what is the transaction status. Also, you can check our Response_code and Response_status solution article for more details.
You should know that since the request is coming from an external system, the CSRF token needs to be excepted.
Response Payload Specifications
Parameter | Sample Response | Nullable | Purpose |
TST2234701408580 | ❌ | Indicates the Transaction Reference on the Paytabs side | |
USD | ❌ | Indicates the currency that used in creating the payment request | |
500.00 | ❌ | Indicates the amounts that used in creating the payment request | |
USD | ❌ | Indicates the transaction currency as it had been stored on the Paytabs side, the acquirer, and the issuer | |
500.00 | ❌ | Indicates the amounts that have been deducted from the customer/cardholder. | |
| ❌ | Indicates the Transaction results details, including the status, the code, the message, and the transaction time | |
❌ | Indicates the form of payment information in detail. | ||
JfN1DVw6w7hrM7mm1P11jNMbzFFAe9WU | ✔ | Only if the card has been tokenized (have a token created representing this card) the card token would be returned within the response. | |
8 | ❌ | A parameter that is used internally by PayTabs technicals. | |
81784 | ❌ | Indicates the profile that created the transaction. | |
31237 | ❌ | Indicates the profile that created the transaction. | |
PMNT0404.6398AB90.000109ED | ❌ | Indicates the code that PayTabs can trace this response with. |
Sample Response Payload
Verify the IPN/Callback Response
It's highly recommended to verify the Return response first. Verifying the received object is a mandatory step to ensure that the request source is Paytabs itself. To know how to perform this, kindly check our How to verify the response received from PayTabs? (Signature Verification) solution article.
⌂ To get familiar with the whole process and the other steps, kindly navigate to our "The PT2 API Endpoints Integration Manual" solution article.
⇦ And to get familiar with the rest of the steps regarding the previuos step "Step 5 - Handle the payment response" kindly click here.
⇨ And to navigate to the next step in the integration process "Step 7 - Manage Transactions" kindly click here.