RDP Hosted and Direct Tokenization API

Hosted Tokenization API – Push Notification Result

Push Notification Description

After the first phase, RDP payment gateway will process the tokenization process. The result
of the payment or transaction will then be communicated to merchant system through two
ways or methods. One of the methods is called ‘Push Notification’.

As the name suggest, RDP push the tokenization 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:

  • It is a POST request toward notify_url.
  • The tokenization result is in a JSON formatted information
  • The tokenization result is put inside the BODY of the request
  • Merchant is required to response with status of 200 (OK) by default when no errors is happened, majority of web framework returns status 200.
  • In the case where merchant is not returning status 200, RDP system will be trying for 3 times consecutively.

Push Notification Result Parameters

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)

  • 0 : success – accepted transaction.
  • -1 : bank / acquirer rejection.
  • -01 : Pending
  • Others (minus) : request-error
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).

order_id Conditional [No-Error] VARCHAR(20)

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.

created_timestamp Conditional [No-Error] DATE - TIME

The date-time when the response is created. In a 24 hour format. Using Kuala Lumpur, Singapore time zone (UTC+08:00).

Format: YYYY-MM-DD hh:mm:ss
Example: 2015-11-14 12:33:27

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 SHA-512 response signature to proof that the message is coming from RDP. For signature generation, validation and note please refer to chapter 4.

merchant_reference Conditional [no-error] VARCHAR(100)

The echo back of merchant_reference in the request

first_6 Conditional [Setup on MID] VARCHAR(6)

The first 6 digits of card number.

last_4 Conditional [Setup on MID] VARCHAR(4)

The last 4 digits of card number.

exp_date Conditional [Setup on MID] VARCHAR(6)

The expiry date of the card used for transaction

payer_id Mandatory VARCHAR(100)

Merchant defined payer ID or customer ID.
Used to identify a unique merchant’s customer.

payer_name Conditional [Setup on MID] VARCHAR(45)

The name of cardholder.

payer_email Conditional [no-error & if available] STRING(60)

The email of customer or cardholder.

ccy Conditional [no-error & if available] In 3 digits ISO-4217 Alphabetical Currency Code format.

Example: SGD, IDR, USD

transaction_type Conditional [No-Error] STRING(1)

The type of tokenization process.
Possible values:

  • C : Create
  • M : Modify
  • R : Remove
token_id Conditional [No-Error] NUMERIC(30)

The token ID that represent or replace the card data.

Push Notification Handling Example

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). '-error-res'.'.txt',
      $e->getMessage());
}