Retrieving data returned in the response
The data returned in the response depends on the parameters sent in the payment request, the payment type, the settings of your shop and the notification format.
The data is always sent by the payment gateway using the POST method.
The first step consists in retrieving the contents received via the POST method.
Examples:
-
In PHP, data is stored in the super global variable $_POST,
-
In ASP.NET (C#), you must use the Form property of the HttpRequest class,
-
In Java, you must use the getParameter method of the HttpServletRequest interface.
Hosted Payment Form format
The response consists of a field list. Each field contains a response value. The field list can be updated.
The script will have to create a loop to retrieve all the transmitted fields.
It is recommended to test the presence of the vads_hash field, which is only present during a notification.
REST API format
Parameters | Description |
---|---|
kr-hash | The hash of the JSON object stored in kr-answer generated with the password (that starts with testpassword_* or prodpassword_*). |
kr-hash-algorithm | Algorithm used to calculate the hash. |
kr-hash-key | Type of key used to sign kr-answer. Always set to password in case of IPN. |
kr-answer-type | Type the JSON object stored in kr-answer. |
kr-answer | Object containing complete transaction objects encoded in JSON. |
It is recommended to test the presence of the kr-hash, kr-hash-algorithm and kr-answer fields before proceeding to processing.
if (empty ($_POST)){ echo 'POST is empty'; }else{ echo 'Data Received '; if (isset($_POST['vads_hash']){ echo 'Form API notification detected'; //Signature computation //Signature verification }else{ if (isset($_POST['kr-hash'])&& isset($_POST['kr-hash-algorithm']) && isset($_POST['kr-answer'])){ echo 'REST API notification detected'; //Signature computation //Signature verification } } }
if (empty ($_POST)){ echo 'POST is empty'; }else{ echo 'Data Received '; if (isset($_POST['vads_hash'])){ echo 'Form API notification detected'; //Signature computation //Signature verification //Order Update } }