When notify_url is filled, the result of the payment or transaction will then be communicated to merchant system through ‘Push Notification’.
As the name suggest, RDP push the payment-result to the Merchant’s system as is indicated by the URL that is sent within the request under the field of notify_url.
The following are the important points of this push notification:
Field Name | Status | Value Type | Description |
---|---|---|---|
response_code | Mandatory | VARCHAR(10) |
Flag which defines whether the transaction is accepted, or has an error in request, or rejected by Acquirer (e.g. Bank). Possible values:
Please refer to ‘Appendix B‘ for complete list of response code. |
response_msg | Mandatory | TEXT |
Description on the response-code |
mid | Conditional [No-Error] | VARCHAR(20) |
The merchant id generated by RDP for merchant, which is used to handle the transaction (can be different from mid used for requesting payment, especially when Merchant has multiple payment-mode with RDP gateway). |
request_mid | Conditional [No-Error] | VARCHAR(20) |
The merchant id generated by RDP for merchant, which is used when requesting the payment. |
order_id | Conditional [No-Error] | VARCHAR(16) |
An echo back to Merchant’s order-id for the transaction as the identifier of the transaction. |
transaction_id | Conditional [No-Error] | VARCHAR(32) |
The RDP generated unique transaction-id, which is used heavily for identifying the resulted transaction in RDP system. |
request_amount | Conditional [No-Error] | NUMERIC |
Echo back the amount as is sent in the request. |
request_ccy | Conditional [No-Error] | In 3 digits ISO-4217 Alphabetical Currency Code format. |
Echo back the currency requested. |
request_timestamp | Conditional [No-Error] | YYYY-MM-DD hh:mm:ss |
The date-time when the request is received or created. In a 24 hour format. Time zone is using (UTC+08:00) Kuala Lumpur, Singapore. |
authorized_amount | Conditional [No-Error] | Numeric |
Amount after applying all of others RDP features. E.g. InstanPromo, Currency-Converter, etc. |
authorized_ccy | Conditional [No-Error] | In 3 digits ISO-4217 Alphabetical |
The final currency that is going to be communicated to Bank/Acquirer. |
transaction_type | Conditional [No-Error] | S, A |
S : Sale transaction A : Authorization transaction |
created_timestamp | Conditional [No-Error] | YYYY-MM-DD hh:mm:ii |
The datetime when the response is created. In a 24 hour format. Timezone is using (UTC+08:00) Kuala Lumpur, Singapore. |
acquirer_response_code | Conditional [No-Error] | TEXT |
Response code from acquirer. Format is specific to each Acquirer |
acquirer_response_msg | Conditional [No-Error] | TEXT |
Description of the response code |
signature | Conditional | VARCHAR(128) |
The response signature. For signature generation, validation and note please refer to sub chapter 4.3.2 (Transaction Response Signature). |
acquirer_authorized_amount | Conditional [on success only] | Numeric |
The amount authorized by acquirer |
acquirer_authorized_ccy | Conditional [on success only] | In 3 digits ISO-4217 Alphabetical Currency Code format. |
The currency authorized by Acquirer. |
merchant_reference | Conditional [no-error] | VARCHAR(100) |
The echo back of merchant_reference in the request message. |
acquirer_created_timestamp | Optional [Acquirer Dependent] | YYYY-MM-DD hh:mm:ii |
The datetime when the response is created. In a 24 hour format. Timezone vary depends on Acquirer. |
acquirer_transaction_id | Optional [Acquirer Dependent] | TEXT |
Transaction ID generated by Acquirer. Existence depends on availability of the fields from acquirer |
acquirer_authorization_code | Conditional [Acquirer Dependent] | VARCHAR |
The authorization code from the Bank. Only when it is available from the Bank response. |
first_6 | Optional [Acquirer Dependent] | VARCHAR(6) |
The first 6 digits of card_no |
last_4 | Optional [Acquirer Dependent] | VARCHAR(4) |
The last 4 digits of card_no |
exp_date | Optional [Acquirer Dependent] | VARCHAR(6) |
The expiry date of the card used for transaction. |
payment_mode | Conditional [no-error] | NUMERIC |
The payment mode or card type that customer used for the transaction. Please refer to Appendix C (Payment Mode List). |
payer_id | Conditional | VARCHAR(100) |
Merchant defined payer ID or customer ID. Used to identify a unique merchant’s customer. |
payer_name | Optional [Acquirer Dependent] | VARCHAR(45) |
The name of cardholder. |
Push notification result example:
{"mid":"1000089029","transaction_id":"pruefer_9is_9901523031657784985","order_id":"pruefer_9is","acquirer_transaction_id":"311815","request_amount":"0.01","request_ccy":"SGD","authorized_amount":"0.01","authorized_ccy":"SGD","acquirer_authorized_amount":"0.01","acquirer_authorized_ccy":"SGD","response_code":"0","response_msg":"successful","acquirer_response_code":"0","acquirer_response_msg":"APPROVED OR COMPLETED","acquirer_authorization_code":"657300","created_timestamp":"2017-05-05 09:49:24","acquirer_created_timestamp":"2017-05-05 09:49:15","first_6":"411111","last_4":"1111","request_timestamp":"2017-05-05 09:49:08","request_mid":"1000089029","transaction_type":"S","payment_mode":"1","signature":"cf966933ef6b23ab45b95e9a0d8d4d51bd024f9ed3aaa0b0ff66132e317f8b0fa077dcd5b50dd2dcc6808d8b00b90b4cc53a9cfa04278118f8a848f86782eb2a"}
Below is the sample code for push notification handling in PHP programming language.
/*
This sample code is retrieving the result from the BODY of an RDP push notification, and parse the JSON into array, traverse and print it out to the screen.
By default a successful PHP script returns status 200
*/
$content = '';
/* RETRIEVE RESULT FROM BODY */
$querystring = @file_get_contents('php://input');
$arrParam = array();
$prefix = '';
try {
$arrParam = json_decode($querystring, true);
$content .= $querystring;
foreach($arrParam as $key => $val) {
$content .=$key.'='.$val."\n";
}
$prefix = "";
if(isset($arrParam["mid"])) $prefix .= $arrParam["mid"];
$prefix .= "_";
if(isset($arrParam["transaction_id"]))
$prefix .= $arrParam["transaction_id"];
file_put_contents(
"notif_log/".$prefix."-".date('Y_m_d_H_i_s').rand(100,999).
'res'.'.txt', $content);
}
catch (Exception $e) {
file_put_contents(
"notif_log/".$prefix."-".date('Y_m_d_H_i_s').rand(100,999).
'-errorres'.'.txt',
$e->getMessage());
}