Order Query
Update Time:2025.01.07The interface provides the query function of all WeChat Pay orders. Merchants can actively query the order status through the order query interface to complete the business logic of next step.
|
1. API Intro
Applicable object: Common mode Institutional mode
Request Url: https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/{transaction_id}
or
https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/out-trade-no/{out_trade_no}
Request method: GET
Path parameter is a path parameter.
Query parameter needs to be passed in the request URL.
Body parameter needs to be passed in the request JSON.
2. Request Parameters
Name | Variable Name | Type | Required | Description |
---|---|---|---|---|
Sub-merchant ID | sub_mchid | string[1,32] | Yes | query Sub-merchant ID allocated by WeChat Pay |
WeChat Pay order No. | transaction_id | string[1,32] | Choose one | path WeChat Pay order No. |
Merchant order No. | out_trade_no | string[1,32] | path Order No. corresponding to the original payment transaction |
Example:
Scenario 1:Common mode
Scenario 2:Service Provide Mode/Institution Mode
3. Response Parameters
Name | Variable Name | Type | Required | Description | |||
---|---|---|---|---|---|---|---|
Merchant ID | mchid | string[1,32] | Yes | Merchant ID allocated by WeChat Pay | |||
App ID | appid | string[1,32] | Yes | Appid bound to the merchant ID | |||
Merchant ID of the service provider | sp_mchid | string[1,32] | Yes | The institution's merchant ID allocated by WeChat Pay | |||
Sub-merchant ID | sub_mchid | string[1,32] | Yes | Sub-merchant ID allocated by WeChat Pay | |||
App ID of the service provider | sp_appid | string[1,32] | Yes | Appid bound to the service provider’s Official Account | |||
App ID of the sub-merchant | sub_appid | string[1,32] | No | Mini program appid of the sub-merchant who initiates the signing | |||
Merchant order No. | out_trade_no | string[1,32] | Yes | Returned merchant order No. | |||
WeChat Pay order No. | transaction_id | string[1,32] | Yes | WeChat Pay order No. | |||
Merchant data | attach | string[1,127] | No | Additional data, returned in the query API and payment notification without any changes; this field is used for the custom order data carried by the merchant | |||
Transaction type | trade_type | string[1,16] | Yes | Deduction payment | |||
Paying bank | bank_type | string[1,32] | No | Returned after successful payment. Bank type is a bank ID of string type. For the list of specific values, please refer to bank type | |||
Payment completion time | success_time | string[1,64] | No | Payment completion time, in the rfc3339 format, e.g., 2018-06-08T10:34:56+08:00 indicates 10:34:56 a.m. on June 8, 2018 of Beijing time | |||
Transaction state | trade_state | string[1,32] | Yes | SUCCESS — Payment success | |||
Transaction state description | trade_state_desc | string[1,256] | Yes | Description of the current order status and guidance for the next operation | |||
Merchant category code (MCC] | merchant_category_code | string[1,16] | Yes | Merchant category code | |||
Payer | payer | object | No | Returned after successful payment. Payer information, which is detailed below | |||
| |||||||
Order amount | amount | object | No | Returned after successful payment. Order amount information, which is detailed below | |||
| |||||||
Scene information | scene_info | object | No | Returned after successful payment. Scene information object, which is detailed below | |||
| |||||||
Promotion function | promotion_detail | array | No | Returned after successful payment. Promotion function information, which is detailed below | |||
|
4. Error Codes
Error Codes | Error Message | Description | Solution |
---|---|---|---|
400 | PARAM_ERROR | Parameter error | Please check the request parameter format. |
400 | ORDER_CLOSED | The order is closed | The order No. of the merchant is abnormal. Please place an order again |
403 | CONTRACT_NOT_EXIST | The contract cannot be found | Please check whether the request contract is correct or whether it is terminated. |
404 | NOT_FOUND | The transaction order No. does not exist | It is advised to confirm that the order No. and merchant ID are correct before query |
500 | SYSTEMERROR | System error | Please try the request again |