Analyzing the payment result
After each payment (accepted or rejected) the gateway sends to the merchant site a notification containing the payment result.
This notification is also called IPN.
To process the payment result, the merchant website must have a separate page that analyzes the data transmitted in POST mode (URL e.g.: https://merchant-website.com/payment_analysis.php)
Depending on the result, this page must trigger different actions (changing the order status, updating stocks, etc.)
- URL of the page that analyzes the payment result must be specified in the Merchant Back Office (see chapter Setting up notifications).
- The merchant has to make sure that this URL is available via the payment gateway without redirection.
Using redirection leads to losing data presented in POST.
- In case some restrictions are set up by the merchant website, the IP address range to be authorized is: 126.96.36.199/24.Notifications are sent from an IP address in the 188.8.131.52/24 range in Test and Production mode.
- HTML must not be visible on the page.
Access to images or CSS slows down the exchange between the payment gateway and the merchant website.
- Avoid integrating time-consuming tasks, such as invoice generation or sending e-mails in the script.
The processing time has a direct influence on how long it takes to display the summary page to the buyer. The longer the processing of the notification, the greater the delay for displaying the page.
After 35 seconds, the payment gateway considers that the call has failed (timeout).
Failed notification (IPN)
In case the call to IPN fails, a notification e-mail is sent to the address specified in the Merchant Back Office (see chapter Setting up notifications).
- The HTTP code of the encountered error,
- Parts of analysis depending on the error,
- Instructions to resend the notification from the Merchant Back Office.
In order to help the merchant to identify the origin of the error, the gateway systematically analyzes the first 512 characters returned by the merchant site.
These characters can be viewed in the transaction details, Event log tab:
Writing the processing script
The processing script must include at least the following steps:
- Retrieve the field list sent with the response in POST mode
- Compute the signature taking into account the data received
- Compare the computed signature with the received signature
- Analyze the nature of the notification
- Retrieve the payment result
The script may check the order status (or any information of your choice) to see if it has not been already updated.
Once these steps are completed, the script can update the database (new order status, stock update, registration of payment information, etc.).