Queries details about all orders that are successfully created and paid through Huawei Pay.
If the value of resultCode is 000000, the order is successfully found, but it does not mean that the order is successfully paid. The order status needs to be determined based on the orderStatus field.
When a transaction order is generated, a merchant can use this API to query the payment status of an order or proactively query the transaction order status to complete the next step of the service logic. The common application scenarios are as follows:
No payment callback notification is received due to network or server exceptions during payment.
An unknown payment status is returned when the payment API is called.
Protocol: HTTPS GET
Direction: Your server -> Payment Kit server
URL: https://petalpay-developer.cloud.huawei.com.cn/api/v2/aggr/transactions/orders/{sysTransOrderNo}
Data format:
Request: Content-Type: application/json; charset=UTF-8
Response: Content-Type: application/json; charset=UTF-8
Request Header
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Content-Type | Yes | String | The value is application/json; charset=UTF-8. |
| PayMercAuth | Yes | String | The value is a JSON string of PayMercAuth. |
Request Path
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| sysTransOrderNo | Yes | String | Transaction order number in the Huawei Pay system. After a user successfully completes the payment, the order number is returned to the merchant through the payment result callback notification or can be queried through the API for querying order information by mercOrderNo. |
GET /api/v2/aggr/transactions/orders/{sysTransOrderNo} HTTP/1.1
Content-Type: application/json;charset=UTF-8
PayMercAuth:
{"callerId":"10132120***","traceId":"202305151047588466083","time":1684118878350,"authId":"120291744647139***","headerSign":"OaLyLiENHhYxXwZ+XhKKiYnzWsX/HJf+02A60A42fjh********************znmsDJOALXgvh/RKeReQBbc4lXZp5wnyZmdwTesmPGdszSNP/s=","bodySign":"kf9AZmVjBSGUI2MldsIFShO+Ak00qpPKaXgJo+K********************7gdghaJShhzAsNjt8DE9ulUIlQ0Q95/dZt2jEHcXyLfGNVzDNfFPhvF08NnnGM4="} 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. The value 000000 indicates success, and other values indicate failure. |
| resultDesc | Yes | String | Result description. |
| subCode | No | String | Service result code. |
| subDesc | No | String | Service result description. |
| sign | Yes | String | Signature, which is used to perform anti-tamper verification on response packets. |
| mercNo | No | String | Merchant number. |
| appId | No | String | App ID. |
| sysTransOrderNo | No | 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. - TRX_APPLY: The transaction is being processed. |
| 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 contains 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 | No | Long | Actual amount paid by the buyer, in cents. |
| promotionAmount | No | 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. |
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{
"resultCode": "000000",
"resultDesc": "Success.",
"sign": "MEUCIQCO8t5lbWmI+94L1DCah********************2XmM05x1SmFAIrepM9Pg=",
"currency": "CNY",
"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,
"sysTransOrderNo": "12407030857530004914518***",
"totalAmount": 10000
} For error codes of resultCode other than 400000, see Common Result Codes.
| Return Code | Result Code | Description | Solution |
|---|---|---|---|
| 400000 | UNKNOW_ERROR | Service temporarily unavailable. Try again later. | Try again later. |
| 400000 | INVALID_ARGUMENTS | Invalid parameter. | Check the request parameters. |
| 400000 | PAY_ORDER_NOT_EXIST | The payment order number does not exist. | Check whether the input order number is correct. |
| 400000 | MERC_ORDER_NOT_EXIST | The merchant order number does not exist. | Check whether the input order number is correct. |
| 400000 | INVALID_MERCNO | Invalid merchant number. | Check whether the input merchant number is correct. |
| 400000 | CHECK_ORDER_STATUS | Order status error. | Check whether this is a duplicate order submission. |