Skip to content

Asynchronous Notification

Description:

  • An asynchronous HTTP notification will be sent to the address of the notificationUrl parameter requested by the transaction when the transaction is completed/refund is completed/chargeback occurs
  • No information needs to be returned upon receiving the notification
  • Acceptance is considered successful when the HTTP CODE returned by the request is 200
  • When the HTTP CODE returned by the request is other values, the system will send the notification again at 5s, 5m, 15m, 30m after the first sending failure
  • Notification request format: HTTP POST application/json

Notification Signature Sign

Signature Rules:
1.Sort all parameters in the returned message except sign in ascending order of ASCII
2.Take out the non-empty values and combine them into a string, add the SecretKey at the end, and encrypt it with SHA256 to get the sign


Notification Return Example

Transaction Response Example

json
{
  "code": 100,
  "appId": 3,
  "isTest": true,
  "uniqueId": "1867098610731065345",
  "transactionType": "Sale",
  "transactionCurrency": "USD",
  "transactionAmount": "94.93",
  "transactionId": "1733985972",
  "billDescription": "description.com",
  "transactionCardNumber": "485023******9618",
  "transactionMessage": "Approved",
  "message": "successful transaction",
  "timestamp": 1733985979185,
  "sign": "82647d814560b4104db20f65388068ee576036e155d7b9964b9f7fe3c12c8d77"
}

Refund response instance

json
{
  "code": 111,
  "transactionType": "Refund",
  "appId": 3,
  "uniqueId": "1867098610731065345",
  "refundCurrency": "USD",
  "refundAmount": "8.88",
  "refundUniqueId": "1867098723574620161",
  "refundMessage": "退款成功",
  // 对应退款请求的refundTransactionId
  "merchantRefundId": "1733985999",
  "message": "Refund successful",
  "timestamp": 1733986022411,
  "sign": "9769300b6821e0e0fe6a8044a1456066c226762e17ba3f0e493fd12ed12da9b8"
}

Chargeback response instance

json
{
  "appId": 1862433537316352001,
  "transactionType": "Chargeback",
  "chargebackCurrency": "HKD",
  "chargebackAmount": "11.00",
  "uniqueId": "1862437361955270657",
  "transactionId": "1732874641",
  "chargebackUniqueId": "1864601282577305601",
  "timestamp": 1733390573134,
  "sign": "614363d4c65c4d15f6ee52cdef770db057a3613ddc7f92f65201b09a853c271c"
}

Signature example

Take[Transaction Response Instance](#Transaction Response Instance) as an example

text
The order of the parameters is as follows
appId,billDescription,code,isTest,message,timestamp,transactionAmount,
transactionCardNumber,transactionCurrency,
transactionId,transactionMessage,transactionType,uniqueId

Take out the non-empty string and combine the strings as follows
3description.com100truesuccessful transaction173398597918594.93485023******9618USD1733985972ApprovedSale1867098610731065345

Add the Secret Key to the end, take the Secret Key as "000000" as an example, after adding it
3description.com100truesuccessful transaction173398597918594.93485023******9618USD1733985972ApprovedSale1867098610731065345000000

Finally, it is encrypted using SHA256
82647d814560b4104db20f65388068ee576036e155d7b9964b9f7fe3c12c8d77

JAVA Demo

Java
  Map<String, Object> map = JSONObject.parseObject(jsonStr, new TypeReference<Map<String, Object>>() {
        });
        StringBuffer buffer = new StringBuffer();
        map.entrySet().stream().sorted(Map.Entry.comparingByKey())
                .filter(x -> !ObjectUtils.isEmpty(x.getValue()) && !"sign".equals(x.getKey()))
                .forEachOrdered(x -> buffer.append(x.getValue()));
        buffer.append("000000");
        String sign = DigestUtils.sha256Hex((buffer.toString()));
        System.out.println(sign);