Skip to main content

Customs Declaration API

The Customs Declaration API allows merchants to report cross-border eCommerce transactions to customs authorities via Alipay or WeChat. This process is required in certain jurisdictions to:
  • Comply with cross-border trade regulations
  • Enable customs clearance
  • Prevent shipment delays
  • Ensure payment and goods release alignment
Customs declaration must be performed after a successful payment.

When to Use

Use this API when:
  • The payment is cross-border
  • Customs reporting is legally required
  • The payment was completed successfully (respcd = 0000)
  • The transaction involves Alipay or WeChat
The QFPay Transaction ID (syssn) used here refers to the payment ID, not a refund ID.

1. Push Customs Declaration

Submit declaration data to Alipay or WeChat.

Endpoint

§§§http HTTP POST /custom/v1/declare §§§

Request Parameters

ParameterRequiredTypeDescription
trade_typeYesString(8)Payment platform: weixin or alipay
syssnYesString(32)QFPay Transaction ID (Payment ID)
customsYesString(20)Customs bureau code (e.g. SHANGHAI_ZS)
mch_customs_noYesString(20)Merchant customs registration number
action_typeNoStringWeChat only: ADD (new) or MODIFY (update)
mch_customs_nameNoStringAlipay merchant record name
out_request_noNoString(32)Unique request ID (Alipay only)
amountNoStringDeclaration amount (Alipay only, e.g. 2.00)

Sub-Order Fields (Split or Modified Orders)

Required only when the original payment is split into multiple customs declarations.
ParameterConditionalTypeDescription
sub_order_noYes (split orders)String(64)Sub-order identifier
fee_typeYes (WeChat only)String(8)Must be CNY
order_feeYes (WeChat only)StringTotal sub-order amount in CNY cents
product_feeYesStringProduct amount in CNY cents
transport_feeYesStringShipping amount in CNY cents

Response Parameters

ParameterDescription
syssnQFPay Transaction ID (Payment ID)
respcd0000 = Success
1143 / 1145 = Pending
Others = Failure
resperrError message
respmsgAdditional info
verify_departmentCustoms authority handling the declaration
verify_department_trade_idCustoms-assigned trade ID

Response Behaviour

  • 0000 → Declaration successfully accepted.
  • 1143 / 1145 → Declaration processing.
  • Other codes → Failed. Merchant should correct and retry.
Customs declaration processing may not be instantaneous.

2. Query Customs Declaration

Check the current status of a declaration.

Endpoint

§§§http HTTP POST /custom/v1/query GET /custom/v1/query §§§

Request Parameters

ParameterRequiredDescription
trade_typeYesweixin or alipay
customsYesCustoms bureau code
syssnYesQFPay Transaction ID (Payment ID)
sub_order_noNoRequired for split-order declarations

Response Fields

ParameterDescription
syssnQFPay Transaction ID
respcdResult code
resperrError reason
respmsgAdditional info
dataArray of sub-declaration records including:
- sub_order_no
- verify_department
- verify_department_trade_id
- resperr
- errmsg

3. Repush Customs Declaration

Use when a previous declaration was not successfully received by customs.

Endpoint

§§§http HTTP POST /custom/v1/redeclare §§§

Request Parameters

ParameterRequiredDescription
trade_typeYesweixin or alipay
customsYesCustoms bureau code
syssnYesQFPay Transaction ID (Payment ID)
mch_customs_noYesMerchant customs registration number
sub_order_noNoRequired for split-order declarations

Integration Notes

Customs declaration must only be submitted after a successful payment (respcd = 0000). Submitting before payment confirmation may cause rejection.
  • Use the payment ID (syssn), not refund ID.
  • Store verify_department_trade_id for reconciliation.
  • For WeChat, split declarations must ensure order_fee = product_fee + transport_fee.
  • For Alipay, ensure mch_customs_name matches your registered customs record.
  • If 1143 / 1145 is returned, query status instead of immediately retrying.
  • Customs declaration rules vary by jurisdiction. Confirm compliance requirements before go-live.

For a complete list of return codes, refer to
Transaction Status Codes.