Query Customs Declaration

Update Time:2025.01.07

Merchants query additional order information submitted and declaration status by order No.


1. API Intro

Applicable object: Common mode Institutional mode

API rules:https://apihk.mch.weixin.qq.com/v3/global/customs/orders

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

Institution APPID

appid

string[1,32]

Yes

Query Specifies Official Account ID assigned
by WeChat
Example: wxd678efh567hg6787

Merchant ID

mchid

string[1,32]

Yes

Query pecifies Merchant ID assigned by
WeChat Payment
Example: 1230000109

Order type

order_type

string[1,16]

Yes

Query Select one of the four order types: out_trade_no - Merchant order No.
transaction_id - WeChat Pay order No.
sub_order_no - Merchant sub-order No.
sub_order_id - WeChat sub-order No.
Example: out_trade_no

Order No.

order_no

string[1,32]

Yes

Query Specify an order No. depending on the selected order type.
Example: 20150806125346

Customs

customs

string[1,32]

Yes

Query Customs for declaration. For the enumerated values, refer to Parameter Specifications
Example: SHANGHAI_ZS

Offset

offset

int

No

Query CA non-negative integer, which indicates the start position of requested resources, starting from 0. Optional. It is 0 by default.
Example: 1

Maximum number of returned records

limit

int

No

Query A positive integer, which indicates the maximum number of resource records that can be returned for this request. Optional. The suggested default value is 20.
Example: 20

Request Example:

URL

1https://apihk.mch.weixin.qq.com/v3/global/customs/orders?appid=wxd678efh567hg6787&mchid=1230000109&order_type=out_trade_no&order_no=20150806125346&customs=SHANGHAI_ZS

3. Response Parameters

Response for successful request:

Name

Variable Name

Type

Required

Description

Institution APPID

appid

string[1,32]

Yes

Official Account ID assigned by WeChat
Example: wxd678efh567hg6787

Merchant ID

mchid

string[1,32]

Yes

Merchant ID assigned by WeChat Pay
Example: 1230000109

WeChat order No.

transaction_id

string[1,32]

Yes

Order No. returned by WeChat Pay
Example: 1000320306201511078440737890

Verification institution

verify_department

string[1,16]

Yes

Verification institution code
UNIONPAY:Unionpay
NETSUNION:NetsUnion
OTHERS:Others
Example: UNIONPAY

Transaction ID from verification institution

verify_department_trade_id

string[1,64]

Yes

Transaction ID from the verification institution (such as UnionPay) for the merchant to register at the customs
Example: 2018112288340107038204310100000

Offset

offset

int

Yes

The offset from which the resource records are returned for the request
Example: 0

Maximum number of returned records

limit

int

Yes

The maximum number of returned records for the request
Example: 20

Total number of query results

total_count

int

Yes

Total number of query results
Example: 1

Customs declaration data packet

data

Array

Yes

Total number of query results

Customs declaration data packet

Response for failed request:

Name

Variable Name

Type

Required

Description

Returned status code

code

string[1,32]

Yes

Error code. See the error code list for the enumerated values.

Returned information

message

string[1,256]

Yes

Returned message. It indicates the reason for the error if not empty.

Detailed error description

detail

object

No

It is returned when code is PARAM_ERROR. Details will be described below.

Detailed error description

Response Example:

SUCCESS

1{
2	"appid": "wxd678efh567hg6787",
3	"mchid": "1230000109",
4	"transaction_id": "1000320306201511078440737890",
5	"verify_department": "UNIONPAY",
6	"verify_department_trade_id": "2018112288340107038204310100000",
7	"offset": 0,
8	"limit": 20,
9	"total_count": 1,
10	"data": [{
11		"sub_order_no": "20150806125346",
12		"sub_order_id": "20150806125346",
13		"mch_customs_no": "1234567",
14		"customs": "SHANGHAI_ZS",
15		"fee_type": "CNY",
16		"order_fee": 888,
17		"duty": 888,
18		"transport_fee": 888,
19		"product_fee": 888,
20		"state": "PROCESSING",
21		"explanation": "The payment order already exists and is in a non-refund status",
22		"modify_time": "2015-09-01T10:00:00+08:00"
23	}]
24}

ERROR

1{
2	"code": "INVALID_REQUEST",
3	"message": "Parameter format verification error",
4	"detail": {
5		"field": "#/properties/payer",
6		"value": "1346177081915535577",
7		"issue": "与ALLOF schema不符",
8		"location": "body"
9	}
10}

 

4. Error Codes

Error Message

Description

Solution

INVALID_REQUEST

Payer's ID No. registered in WeChat is invalid. Please make a check.

There is a problem with the payer's identity information registered in WeChat. Contact WeChat Pay Assistant to find out the reason.

Customs declaration record does not exist.

The customs declaration record does not exist. Please apply again or contact WeChat Pay Assistant to find out the reason.

Customs information is not configured.

The customs declaration API is only accessible after the customs information has been configured for the merchant. Please configure the customs information by referring to the customs registration guidelines above.

NOAUTH

The merchant has not registered with the current customs.

The merchant has not registered with the current customs. Try again after the registration is completed.

Self-Clearance is not enabled. error

Check whether the Self-Clearance tool has been enabled for the merchant ("WeChat Pay Merchants Platform" > "Product Center" > "Apply for Self-Clearance").

PARAM_ERROR

Parameter error

Invalid parameter. The parameter may be incorrect or is missing. Check whether the API parameters have been summited as required.

Merchant entered invalid user ID No.

Enter the correct ID No. If you still get an error, contact WeChat Pay Assistant to find out the reason.

SYSTEMERROR

System error

Declare again, or contact WeChat Pay Assistant to find out the reason.

USER_ACCOUNT_ABNORMAL

The identity information on the payment order for declaration does not match the payer's registered identity information. Customs declaration is not allowed.

The identity information on the payment order for declaration does not match the payer's registered identity information. Enter the actual payer's identity information and declare 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.