Callback Verification
The platform only sends callbacks for SUCCESS trades. The signature is the same as merchant requests (HMAC-SHA256 + Base64).
Callback headers
| Header | Required | Description |
|---|---|---|
X-Merchant-Id | Yes | Merchant primary ID |
X-Timestamp | Yes | Unix timestamp (milliseconds) |
X-Nonce | Yes | 32-char random string |
X-Sign | Yes | HMAC-SHA256 signature (Base64) |
HTTP header names are case-insensitive.
Signature algorithm
Signature string in fixed order (delimited by |):
timestamp|nonce|rawBodySignature calculation:
signature = Base64(HMAC_SHA256(SignData, merchant_secret))rawBody is the exact JSON string received in the callback. Do not reformat or reorder fields.
Callback example
json
{
"payNo": "P202312230001",
"tradeNo": "T202312230001",
"merchantOrderNo": "ORDER_001",
"amount": 10000,
"currency": "USD",
"tradeStatus": "SUCCESS",
"finishTime": 1734921000000,
"notifyTime": 1734921005000
}Verification steps
- Read
X-Timestamp,X-Nonce, andX-Signfrom headers. - Build the sign string with the raw request body and compute the signature.
- Compare the computed value to
X-Sign.
Handling notes
- Always verify before processing business logic.
- Callbacks may be delivered multiple times; handle idempotency.
- Return
200 OKquickly to avoid retries.