API callback (POST)

Callback ( JSON Format):

Parameter Type Description
rsp_code String Response Code
rsp_msg String Response Message
merchant_id String Merchant ID
data String Encrypted Callback Data
md5 String Information

Decryption Steps

Where data is the encrypted callback data, and the steps to decrypt it are as follows:

  1. Concatenate the md5 string in the callback information and the merchant signkey provided by OTT Pay into a string in sequence.
  2. Perform 16-bit md5 calculation on this concatenated string (indicate the result in uppercase) to get the key for decryption.
  3. Apply Base64 decoding to the data string in the callback information and use the decryption key just obtained to perform standard AES decryption (AES working mode: ECB, key length: 128).

The decrypted data is in JSON format, and the content is as follows:

Parameter Type Sample Data Description
finish_time String Format yyyyMMddHHmmss 2024-01-08 16:29:03 CST Transaction Time. The timestamp on the gateway when the transaction or the query was initiated by the client. Time zone is always calculated/displayed in DST irrespective of the merchant location.
merchant_id String CAMB006711 OTT Pay Merchant ID
order_id String 17047528085325164 OTT Pay Payment ID.
order_status String authorised/captured Payment status, please see Payment Status.
amount String 9955 Transaction Amount
tip String 0 Tip Amount
bizpay_order_id String JKZ2NDF5GC5PPJ65 Channel Order Number
remarks String 20240108172641374 Remark
exchange_rate String 5.057030 Currency exchang rate. This is only for Chinese Wallet Payment, not applicable for local card transaction.
sale_num String Merchant sales number. Invoice number for split payment.
convenience_fee String 0 Fees. This is only for Chinese Wallet Payment, not applicable for local card transaction.
sub_openId String 2088032832386722 Chinese Wallet Payment’s client ID.
reference String PTM3835286374203402 The reference number from 3rd party. This can be used for order IDs that generated by integrate merchant.

Decryption Example

This is the callback message with transaction data (JSON data format) as follows,

{
  "data": "vg8LJmi7ryeVxUTVfPC6N1l5ebL9cgn4MdlyLFEL6eqZQN+XvkvNhZevFmRitDLTUTcAcRnKYs407K3ePY2pslEgZYDoa9x80PBh95s7aqAYCwUlY5j9IUtklLlzqNT0mFPS7Fn5p6cr1EkBRVh82QHueCdkWVoFhvVHVYYrwQqF5cmPO+JNuDOei6goomz1QTfvv7M8zc4TT+r/EwKIDm4eoV9EeTk98gSiUy4+2ThLRrtZOFHqVP7OAjJ318X2EIKoZRA5lp42kdRVmd/mXi8aZpTVEiAT2GK7p3TNXFNXuPLcl6DhEUK9FLMrHcl4",
  "rsp_code": "SUCCESS",
  "rsp_msg": "success",
  "merchant_id": "ON00004652",
  "md5": "5A917182659DE14DCB3022CA6518F34F"
}
Step-1: Concatenate the md5 string in the callback information and the merchant signkey provided by OTT Pay into a string in sequence.

md5 String:

5A917182659DE14DCB3022CA6518F34F

signkey:

A8B5FE540E38A5A9

After concatenated:

5A917182659DE14DCB3022CA6518F34FA8B5FE540E38A5A9
Step-2: Perform 16-bit md5 calculation on the concatenated string (represent the result in uppercase) to get the key for decryption
BFE59D83C221F217
Step-3: Apply Base64 decoding to the data string in the callback message and perform AES decryption:

Chinese Wallet Payment transaction

{
  "amount": "3",
  "bizpay_order_id": "AL5909918566288061",
  "exchange_rate": "5.057030",
  "tip": "1",
  "merchant_id": "ON00004652",
  "order_id": "16795056216014900",
  "finish_time": "2023-03-23 01:21:53",
  "remarks": "可以",
  "sub_openId": "2088032832386722",
  "reference": "PTM3835286374203402"
}

Local Card Payment transaction

{
  "reference":"20240108172641374",
  "order_status":"captured",
  "amount":"9955",
  "bizpay_order_id":"JKZ2NDF5GC5PPJ65",
  "tip":"0",
  "merchant_id":"CAMB006711",
  "order_id":"17047528085325164",
  "finish_time":"2024-01-08 16:29:03 CST",
  "remarks":"20240108172641374"
}