Order Query

Update Time:2025.01.07

The 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.

Tips:

Circumstances when the query interface needs to be called:

  • An exception is found with the merchant background, network, or server, and the merchant system does not receive the payment notification finally.

  • After the deduction interface is called, a system error or unknown transaction status is returned.


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
Note: Only for Institutional mode
Example: 10000097

WeChat Pay order No.

transaction_id

string[1,32]

Choose one

path WeChat Pay order No.
Example: 10000097

Merchant order No.

out_trade_no

string[1,32]

path Order No. corresponding to the original payment transaction
Example: 1217752501201407033233368018

Example:

Scenario 1:Common mode

1https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/1217752501201407033233368018
2or
3https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/out_trade_no/1217752501201407033233368018

Scenario 2:Service Provide Mode/Institution Mode

1https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/1217752501201407033233368018?sub_mchid=10000097
2or
3https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/out_trade_no/1217752501201407033233368018?sub_mchid=10000097  

 

3. Response Parameters

Name

Variable Name

Type

Required

Description

Merchant ID

mchid

string[1,32]

Yes

Merchant ID allocated by WeChat Pay
Note: Only for Common mode
Example: 10000091

App ID

appid

string[1,32]

Yes

Appid bound to the merchant ID
Note: Only for Common mode
Example: wxcbda96de0b165486

Merchant ID of the service provider

sp_mchid

string[1,32]

Yes

The institution's merchant ID allocated by WeChat Pay
Note: Only for Institutional mode
Example: 10000098

Sub-merchant ID

sub_mchid

string[1,32]

Yes

Sub-merchant ID allocated by WeChat Pay
Note: Only for Institutional mode
Example: 10000097

App ID of the service provider

sp_appid

string[1,32]

Yes

Appid bound to the service provider’s Official Account
Note: Only for Institutional mode
Example: wxcbda96de0b165486

App ID of the sub-merchant

sub_appid

string[1,32]

No

Mini program appid of the sub-merchant who initiates the signing
Note: Only for Institutional mode
Example: wxcbda96de0b165484

Merchant order No.

out_trade_no

string[1,32]

Yes

Returned merchant order No.
Example: 1217752501201407033233368018

WeChat Pay order No.

transaction_id

string[1,32]

Yes

WeChat Pay order No.
Example: 1217752501201407033233368018

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
Example: Custom data

Transaction type

trade_type

string[1,16]

Yes

Deduction payment
Example: AUTH

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
CMC and other bank card types in the Chinese mainland
WPHK: payment by Hong Kong Wallet
WPHK_BPA: advance money by Hong Kong Wallet
Example: WPHK

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
Example: 2018-06-08T10:34:56+08:00

Transaction state

trade_state

string[1,32]

Yes

SUCCESS — Payment success
REFUND — Transfer to refund
NOTPAY — Not paid
CLOSED — Closed
PAYERROR — Payment failed
USERPAYING — payment in progress
Example: SUCCESS

Transaction state description

trade_state_desc

string[1,256]

Yes

Description of the current order status and guidance for the next operation
Example: Payment failed. Please order again to make payment

Merchant category code (MCC]

merchant_category_code

string[1,16]

Yes

Merchant category code
Example: 1011

Payer

payer

object

No

Returned after successful payment. Payer information, which is detailed below

Payer

Order amount

amount

object

No

Returned after successful payment. Order amount information, which is detailed below

Order amount

Scene information

scene_info

object

No

Returned after successful payment. Scene information object, which is detailed below

Scene information

Promotion function

promotion_detail

array

No

Returned after successful payment. Promotion function information, which is detailed below

Promotion function


4. Error Codes

Error Codes

Error Message

Description

Solution

400

PARAM_ERROR

Parameter error

Please check the request parameter format.

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

 

 

About  WeChat  Pay

Powered By Tencent & Tenpay Copyright©

2005-2025 Tenpay All Rights Reserved.

Contact Us
Wechat Pay Global

WeChat Pay Global

Contact Us

Customer Service Tel

+86 571 95017

9:00-18:00 Monday-Friday GMT+8

Business Development

wxpayglobal@tencent.com

Developer Support

wepayTS@tencent.com

Wechat Pay Global

About Tenpay
Powered By Tencent & Tenpay Copyright© 2005-2025 Tenpay All Rights Reserved.