Analyzing the payment result
To process the payment result, the merchant website must have a separate page with a script (e.g. analyze_payment.php).
This page will be automatically called after each payment (whether it has been accepted or declined): the parameters linked to the payment result are sent in POST mode by the payment gateway.
- 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, the 188.8.131.52/24 IP address range must be authorized.Notifications are sent from an IP address in the 184.108.40.206/24 range in Test and Production mode.
- HTML should not be visible on the page.
Access to images or CSS may slow down the exchange between the payment gateway and the merchant website.
Furthermore, the payment gateway systematically reads the 512 first characters returned by the merchant website.These characters can be viewed in the transaction history.
- 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 payment summary page. The longer the processing of the notification, the greater the delay for displaying the page.
After 35 seconds, the payment gateway will consider 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,
- analysis parts depending on the error,
- instructions for resending the notification from the Merchant Back Office.
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
- Computing the signature
- Compare the computed signature with the received signature
- Analyzing the notification nature
- 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.).