Implementing the IPN
The script must include at least the following steps:
- Retrieve the field list sent with the POST response
- Compute the signature taking into account the received data
- 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.).
In order to facilitate support and diagnosis by the merchant in the event of a notification error, we recommend to write messages that will allow you to know at which stage of processing the error occurred.
The gateway reads and stores the first 256 bytes of the HTTP response.
You can write messages throughout the processing. Here are some examples of messages that you can use:
|Data received||Message to display when retrieving data.
Allows to confirm that the notification has been received by the merchant website.
|POST is empty||Message to display when retrieving data.
Allows to bring out a possible redirection that would have caused the parameters posted by the payment gateway to be lost.
|An error occurred while computing the signature.||Message to be displayed when the verification of the response signature has failed.|
|Order successfully updated.||Message to be displayed at the end of the file once your processing has been successfully completed.|
|An error occurred while updating the order.||Message to be displayed at the end of the file if an error occurred during your processing.|