Sends key payment event notifications to your server from the Payment Kit server upon successful completion of a user payment.
To ensure the reliability of callback requests, the system implements a retry mechanism. Therefore, the same notification may be resent.
The order status is determined by the orderStatus field.
After an order is successfully paid, the Payment Kit server calls the callback API (specified by callbackUrl) passed in the pre-order API to send the order payment details.
Protocol: HTTPS POST
Direction: Payment Kit server -> Your server
URL: Callback URL passed in the pre-order API request.
Data format:
Request: Content-Type: application/json; charset=UTF-8
Response: Content-Type: application/json; charset=UTF-8
Request Body
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| callbackId | Yes | String | Unique ID of a callback notification. |
| callbackTime | Yes | String | Time when a callback notification is sent. The format is yyyy-MM-dd HH:mm:ss. |
| dataType | Yes | String | Data encryption type. - encrypt: encryption - plain: plaintext |
| sign | Yes | String | Signature of the callback notification result. All fields except the sign field are involved in signing. You can perform signature verification on the callback packet by referring to Signature Verification Rules. |
| signType | Yes | String | Signature type. Algorithm used to generate the signature string. Currently, the SM2 algorithm is used. |
| certNo | No | String | Certificate number used for signing. |
| mercNo | Yes | String | Merchant number. |
| appId | Yes | String | App ID. |
| sysTransOrderNo | Yes | String | Transaction order number in the Huawei Pay system. |
| mercOrderNo | Yes | String | Merchant order number, which is generated by the merchant and must be unique. The value contains a maximum of 46 characters. |
| orderStatus | Yes | String | Order status. - TRX_SUCCESS: The transaction is successful. - TRX_FAILED: The transaction failed. |
| payload | No | String | Reserved information. If this parameter is passed in a merchant request, it will be returned as-is. |
| currency | Yes | String | Transaction currency. The value can contain a maximum of 3 characters. The default value is CNY. Currently, only this currency is supported. |
| totalAmount | Yes | Long | Total order amount, in cents. |
| payerAmount | Yes | Long | Actual amount paid by the buyer, in cents. |
| promotionAmount | Yes | Long | Discount amount, in cents. |
| finishTime | No | String | Payment completion time, in UTC format (yyyy-MM-dd'T'HH:mm:ss.SSSZ). |
| paymentTools | No | String | Payment tools. - WECHAT_MICROPAY: WeChat Pay connected through Huawei Pay - AGMT: payment using a debit or credit card based on an agreement - ACCT: account balance - HUAWEIPAY: Huawei Pay |
| promotionDetail | No | List<PromotionItem> | Promotion information. Note: This parameter value is returned only when a user participates in promotion activities during payment. |
| payer | No | PayerOut | Payer information shown on the client during payment. |
POST /hw/pay/callback HTTP/1.1
Content-Type: application/json;charset=UTF-8
{
"callbackId": "124070308575300049145189***",
"callbackTime": "2023-03-29 09:29:14",
"currency": "CNY",
"dataType": "plain",
"finishTime": "2023-02-23T10:02:04.000+0800",
"mercOrderNo": "czl00120240705***",
"appId": "5765880207853***",
"mercNo": "10132120***",
"orderStatus": "TRX_SUCCESS",
"payerAmount": 10000,
"payload": "example-payload",
"paymentTools": "AGMT",
"promotionAmount": 0,
"sign": "MEYCIQDXutp78*******************VlWyjA6p210xOqI2InX9w2SIYRx",
"signType": "SM2",
"certNo": "120291744647139***",
"sysTransOrderNo": "12407030857530004914518***",
"totalAmount": 10000
} Response Header
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Content-Type | Yes | String | The value is application/json; charset=UTF-8. |
Response Body
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| resultCode | Yes | String | Result code. Huawei Pay parses the response of the application/json type. The value 000000 indicates success, and other values indicate failure. If the return value format is invalid or the return value is not 000000, the callback fails. |
| resultDesc | Yes | String | Result description. |