API callback (POST)

Callback ( JSON Format):

ParameterTypeDescription
rsp_codeStringResponse Code
rsp_msgStringResponse Message
merchant_idStringMerchant ID
dataStringEncrypted Callback Data
md5StringInformation

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:

ParameterTypeSample DataDescription
finish_timeString Format yyyyMMddHHmmss2024-01-08 16:29:03 CSTTransaction 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_idStringCAMB006711OTT Pay Merchant ID
order_idString17047528085325164OTT Pay Payment ID.
order_statusStringauthorised/capturedPayment status, please see Payment Status.
amountString9955Transaction Amount
tipString0Tip Amount
bizpay_order_idStringJKZ2NDF5GC5PPJ65Channel Order Number
remarksString20240108172641374Remark
exchange_rateString5.057030Currency exchang rate. This is only for Chinese Wallet Payment, not applicable for local card transaction.
sale_numStringMerchant sales number. Invoice number for split payment.
convenience_feeString0Fees. This is only for Chinese Wallet Payment, not applicable for local card transaction.
sub_openIdString2088032832386722Chinese Wallet Payment’s client ID.
referenceStringPTM3835286374203402The 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"
}