Skip to main content

Customs Declaration

Customs Declaration APIs allow merchants to automatically report cross-border eCommerce transactions to the relevant customs authorities. This supports compliance, streamlines clearance procedures, and helps reduce delays in product delivery.


1. Push Customs Declaration

Use this endpoint to submit customs information to Alipay or WeChat after a successful payment.

HTTP Request

POST /custom/v1/declare

Request Parameters

ParameterRequiredTypeDescription
trade_typeYesString(8)Payment platform: weixin or alipay
syssnYesString(32)QFPay transaction number
customsYesString(20)Customs bureau code, e.g. SHANGHAI_ZS
mch_customs_noYesString(20)Merchant’s customs registration number
action_typeNoString(256)Declaration type (WeChat only): "ADD" (new) or "MODIFY" (update)
mch_customs_nameNoString(256)Alipay merchant record name (e.g. jwyhanguo_card)
out_request_noNoString(32)Unique request ID for Alipay declaration
amountNoString(20)Declaration amount (Alipay only), e.g. 2.00

Sub-Order Fields (for split or modified declarations)

ParameterConditionalTypeDescription
sub_order_noCString(64)Required if the order is split into sub-orders
fee_typeCString(8)Currency (WeChat only). Must be CNY
order_feeCString(8)Total sub-order amount in CNY cents = transport_fee + product_fee
product_feeCString(8)Product portion of the sub-order
transport_feeCString(8)Shipping portion of the sub-order

Response

ParameterTypeDescription
syssnString(40)QFPay transaction number
respcdString(4)0000 = Success
1143/1145 = Pending
Others = Failure
resperrString(128)Error reason
respmsgString(128)Additional information
verify_departmentStringCustoms department that processed the declaration
verify_department_trade_idStringTrade ID assigned by customs system

2. Query Customs Declaration

Use this API to check the status of a customs declaration.

HTTP Request

POST /custom/v1/query
GET /custom/v1/query

Request Parameters

ParameterRequiredTypeDescription
trade_typeYesString(8)Payment platform: weixin or alipay
customsYesString(20)Customs bureau code
syssnYesString(32)QFPay transaction number
sub_order_noNoString(40)Required only for split-order declarations

Response

ParameterTypeDescription
syssnString(40)QFPay transaction number
respcdString(4)Response code
resperrString(128)Error reason
respmsgString(128)Additional info
dataArrayList of sub-declaration records with:
- resperr
- errmsg
- sub_order_no
- verify_department
- verify_department_trade_id

3. Repush Customs Declaration

Use this when a previous declaration was lost or not received by customs.

HTTP Request

POST /custom/v1/redeclare

Request Parameters

ParameterRequiredTypeDescription
trade_typeYesString(8)weixin or alipay
customsYesString(20)Customs bureau code
syssnYesString(32)QFPay transaction number
mch_customs_noYesString(20)Merchant’s customs registration number
sub_order_noNoString(40)Required only for split-order declarations

Response

Same format as Push Customs Declaration


Additional Notes

tip
  • All customs declarations must be made after a successful transaction (respcd=0000).
  • For Alipay declarations, ensure you use the correct registered customs name (mch_customs_name) and number.
  • WeChat declarations may require sub-order splitting and specific currency settings.
  • Declarations are mandatory for certain jurisdictions to ensure product release and compliance.

For a full list of codes, see Transaction Status Codes.