Status Retrievals (LEGACY)
Getting notification when a status changes
Response | Version | ||
---|---|---|---|
TXT_GET | Parameters are sent via GET variabeles | TRUE|#verification# | Current |
TXT_POST | Parameters are sent via POST variabeles | TRUE|#verification# | Current |
JSON_GET | Parameters are sent via GET |
| Current |
JSON_POST | Parameters are sent via POST variabeles |
| Current |
Parameters
When calling the exchange / communication URL, PAY. includes a number of POST / GET parameters.
The actual call may include more parameters, depending on the selected payment option.
Parameter | Description | Available |
---|---|---|
action | The action that has occurred. Click here for more information about the moment of calling. | YES |
order_id | The order ID with which you can verify the order's current status. | YES |
payment_session_id | The order’s payment session ID | DEPRICATED |
ip_address | The user’s IP address | YES |
amount | The amount of the transaction | YES |
extra1 | Free variable “extra1” that can be traced in the statistics. This variable may be included when starting the transaction. | OPTIONAL |
extra2 | Free variable “extra2” that can be traced in the statistics. This variable may be included when starting the transaction. | OPTIONAL |
extra3 | Free variable “extra3” that can be traced in the statistics. This variable may be included when starting the transaction. | OPTIONAL |
info | Free variable “info” that can be traced in the statistics. This variable may be included when starting the transaction. | OPTIONAL |
Request calls
The exchange call is invoked when the status of a transaction changes. The moment of invocation is indicated by the 'action' variable. This can vary per payment option and is shown below.
Action | Payment option | Description |
---|---|---|
new_ppt | All | Immediately after a payment is successfully completed. |
pending | All | Immediately after starting the payment |
cancel | All | Immediately after a payment is terminated or expired |
refund:add | All | Immediately after invoking the refund API or when a refund is created manually via the PAY. Admin Panel. |
refund:received | All | Immediately after a payment has been refunded. Refunds are processed immediately for the payment in arrears, gift card and credit card payment methods. IBAN refunds are placed in a batch and processed by the bank in question at around 10 AM. |
refund:send | IBAN payment options | Immediately after the bank has processed the refund batch. Only applies to IBAN refunds. |
refund:storno | IBAN payment options | A created refund could not be processed. An example is a refund to a revoked/blocked IBAN number |
capture | BNPL and creditcard | Immediately after the authorisation has been switched to a capture. Only applies when autocapture (default) has been turned off. |
verify | Creditcard | Immediately after we flag a transaction as “suspicious.” This basically means that PAY. does not approve or reject the transaction yet. Its status must first be determined with an additional verification step. |
transaction:fraudnotice | Creditcard | Immediately after receiving a fraud report for a credit card transaction |
chargeback:revert | Creditcard | Immediately after a credit card chargeback is reversed |
chargeback:chargeback | Creditcard | Immediately after we flag a transaction as “chargeback”. A chargeback is demand by a credit-card provider to make good the loss on a fraudulent or disputed transaction. |
incassoadd | Direct debit | Immediately after PAY. has processed the direct debit |
incassosend | Direct debit | Immediately after the direct debit request has been sent to the bank in question. |
incassocollected | Direct debit | Immediately after the collected amount has been deposited into PAY.’s account. From that moment, it is also available on your balance. |
incassostorno | Direct debit | Immediately after the collected amount has been recollected from our account. This may occur up to 56 calendar days after reception of the “incassocollected”. |
Required response
To verify whether a request was received properly, we expect a response for your server in the TXT format. This response must consist of the word TRUE. If the correct response is not received, PAY. will consider the call failed and the retry scheme will be initiated (if one was set up).
HTTP status code must be 200 for a correct Exchange call, if we receive any other result, we mark the request as failed an the retry sceme will resend the request.
Processing exchange call
It is essential that you process the transaction via the exchange URL, not via the return URL. Not every customer reaches the return URL, because some people close the payment screen immediately after completing the payment. The return URL is therefore only intended to let customers know whether their payment was successful.
Contrary to the return URL, the exchange URL is always called. This is therefore where you can process orders in your back office, e.g. by updating its status in your database, sending an invoice or email, et cetera.
Verifying status
You should always verify the status of a transaction using the order_id parameter, just like in the PHP code example. Do not use the action parameter to determine the transaction’s status, as it may have been changed manually in the URL.
Exchange timingWith many payment methods, the exchange URL is called in the Payment process. If the exchange response within the MAX-exhange-timeout, your platform will know the status before the user get's back on the Return URL. If you fail to respond within 5seconds, we transfer the user back to your shop, and retry the call via the selected retry sceme.
<?php
# Setup API Url
$strUrl = "https://rest-api.pay.nl/v7/Transaction/info/array_serialize?";
# Add arguments
$arrArguments = array();
$arrArguments['transactionId'] = filter_var(
$_GET['order_id']);
# Prepare complete API URL
$strUrl = $strUrl . http_build_query($arrArguments);
$objCurl = curl_init($strUrl);
curl_setopt($objCurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($objCurl, CURLOPT_USERAGENT, "Pay.nl
Api Example");
curl_setopt($objCurl, CURLOPT_TIMEOUT, 5
);
curl_setopt($objCurl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($objCurl, "AT-XXXX-XXXX:<your-api-token>");
$strReturnData = curl_exec($objCurl);
curl_close($objCurl);
# Process result
$strMessage = '';
$arrResult = unserialize($strReturnData);
if(isset($arrResult['paymentDetails']['stateName'])) {
if($arrResult['paymentDetails']['stateName'
] == 'PAID') {
# Execute code to process the order
$strMessage = 'Order processed';
}
elseif($arrResult['paymentDetails']['stateName'] == 'CANCEL') {
# Payment canceled, restock items
$strMessage = 'Order canceled';
}
}
echo 'TRUE|'.$strMessage;
Multicore
If you use the multicore, and you do not store the used core endpoint, you can calculate the Core Endpoint based on the generated orderID
Core | Order ID Prefix | Example |
---|---|---|
pay.nl | 2 | 2225050761Xd45454 |
fasterpay.nl (fallback core) | 3 | 3165050761Xd45232 |
achterelkebetaling.nl | 51 | 5165050761Xd45232 |
payments.nl | 52 | 5225050761Xd4554 |
Updated 3 months ago