Documentation/API Reference

API REFERENCE

Submit a customs declaration

POSThttps://mapi.yabandpay.com/Payments
Live API
API PLAYGROUND · Live API

Submit a customs declaration

POSThttps://mapi.yabandpay.com/Payments
Automatically signed with your credentials

Request parameters14

Required fields first

Submit a customs declaration

trade_idRequiredstringdata.trade_idYabandPay transaction ID
customsRequiredstringdata.customsCustoms name
mch_customs_noRequiredstringdata.mch_customs_noMerchant customs registration number
mch_nameRequiredstringdata.mch_nameMerchant name registered with customs
Optional parameters 10
dutyOptionalintegerdata.dutyCustoms duty in fen; not submitted to customs
action_typeOptionalstringdata.action_typeDeclaration action: ADD to add, MODIFY to modify; defaults to ADD
sub_order_noComplete groupstringdata.sub_order_noMerchant sub-order numberOptional (required for split orders)
currencyComplete groupstringdata.currencyDeclaration currency; CNY is recommendedOptional (required for split orders)
order_feeComplete groupintegerdata.order_feeSub-order amount (obtain the total order amount amount_cny through QueryOrder), order_fee=transport_fee+product_feeOptional (required for split orders)
transport_feeComplete groupintegerdata.transport_feeSub-order shipping amount in fenOptional (required for split orders)
product_feeComplete groupintegerdata.product_feeSub-order product price in fenOptional (required for split orders)
cert_typeOptionalstringdata.cert_typeIdentity document type; pass the fixed value IDCARD. Only mainland China identity cards are currently supported.
cert_idOptionalstringdata.cert_idIdentity document number: the user's mainland China identity card number. If the number ends with X, use an uppercase X.
nameOptionalstringdata.nameUser's name

Credentials stay on this page. Your secret key is never stored or sent to the documentation server.

Tip

Note:

  1. Each order can have only one unsplit-order record and multiple split-order records. Split-order records with the same sub_order_no (merchant sub-order number) are treated as the same record.
  1. To modify customs declaration information, set action_type to MODIFY. Only the merchant registration number, registered name, customs code and amount, and user identity document information can be modified. For split-order records, pass sub_order_no to identify the record to modify.
  1. If a transaction has been submitted for customs declaration but the electronic port loses the order, use the resend API. When resending, keep the customs declaration reference number the same as in the original request.
  1. Amounts in the customs declaration API are in fen.
  1. The customs declaration currency is CNY (the amount paid by the user in CNY), which can be obtained through Order query.
ParameterTypeDescriptionRequired
userStringUID of the cashier or super administrator accountRequired
signStringSignatureRequired
methodStringv3.CustomDeclareOrderRequired
timeLongTimestampRequired
  • Parameters
ParameterTypeDescriptionRequired
trade_idStringYabandPay transaction IDRequired
customsStringCustoms nameRequired
mch_customs_noStringMerchant customs registration numberRequired
mch_nameStringMerchant name registered with customsRequired
dutyIntCustoms duty in fen; not submitted to customsOptional
action_typeStringDeclaration action: ADD to add, MODIFY to modify; defaults to ADDOptional
sub_order_noStringMerchant sub-order numberOptional (required for split orders)
currencyStringDeclaration currency; CNY is recommendedOptional (required for split orders)
order_feeIntSub-order amount (obtain the total order amount amount_cny through QueryOrder), order_fee=transport_fee+product_feeOptional (required for split orders)
transport_feeIntSub-order shipping amount in fenOptional (required for split orders)
product_feeIntSub-order product price in fenOptional (required for split orders)
cert_typeStringIdentity document type; pass the fixed value IDCARD. Only mainland China identity cards are currently supported.Optional
cert_idStringIdentity document number: the user's mainland China identity card number. If the number ends with X, use an uppercase X.Optional
nameStringUser's nameOptional

customs field values:

WeChat Pay customs declaration values

FieldDescription
GUANGZHOU_ZSGuangzhou (General Administration version)
GUANGZHOU_HP_GJGuangzhou Huangpu Inspection and Quarantine
GUANGZHOU_NS_GJGuangzhou Nansha Inspection and Quarantine
HANGZHOU_ZSHangzhou (General Administration version)
NINGBONingbo
ZHENGZHOU_BSZhengzhou (Bonded Logistics Center)
CHONGQINGChongqing
SHANGHAI_ZSShanghai (General Administration version)
SHENZHENShenzhen
ZHENGZHOU_ZH_ZSZhengzhou Comprehensive Bonded Zone (General Administration version)
TIANJINTianjin

TIANJIN (To send an order to Tianjin Customs, configure both the Tianjin Customs registration information and the Tianjin Inspection and Quarantine registration information in the merchant management portal. When calling the customs declaration API, send only to Tianjin Customs, using a single API request.)

Alipay customs declaration values

FieldDescription
ZONGSHUGeneral Administration of Customs of China
ZHENGZHOUZhengzhou
NINGBONingbo
SHANGHAI_CBTShanghai

Signature example:

Sorted parameters concatenated into a URL-style query string

"customs=NINGBO&mch_customs_no=3302462090&mch_name=宁波保税区嘉里大通物流有限公司&method=v3.CustomDeclareOrder&time=1560499094&trade_id=4760a968-4c5d-1e7e-3b88-89641af6e041&user=YOUR_CASHIER_UID"

Sign stringA using secret_key

The resulting signature is:

"YOUR_SIGNATURE"

Request example:

{
	"user": "YOUR_CASHIER_UID",
	"sign": "YOUR_SIGNATURE",
	"method": "v3.CustomDeclareOrder",
	"time": 1560499094,
	"data": {
		"trade_id": "4760a968-4c5d-1e7e-3b88-89641af6e041",
		"customs": "NINGBO",
        "mch_customs_no": "3302462090",
        "mch_name": "宁波保税区嘉里大通物流有限公司"
	}
}

Customs declaration response example:

{
    "status": true,
    "code": "200",
    "data": {
        "appid": "",
        "return_code":"SUCCESS",
        "result_code":"SUCCESS",
        "mchid": "3302462090",
        "out_trade_no": "4434a6e235e81cde4aee954c0031ad96",
        "state": "SUCCESS",
        "sub_order_id": "e0721a7f957e8e55dfbb5c7bcb4441d6",
        "sub_order_no": "1234567890",
        "transaction_id": "2024061922001467961423939655",
        "verify_department": "OTHERS",
        "verify_department_trade_id": "2024061922001467961423939655",
        "cert_check_result": "SAME", //Identity comparison between the purchaser and payer (UNCHECKED: purchaser identity not uploaded; SAME: uploaded purchaser identity matches payer identity; DIFFERENT: uploaded purchaser identity differs from payer identity)
        "transId": "20240619161756813048",
        "customs_declarations_id": "e0721a7f957e8e55dfbb5c7bcb4441d6"
    },
    "message": ""
}

State statuses:

StatusDescription
UNDECLAREDUndeclared (the declaration has been submitted and is awaiting customs processing; no resubmission is needed)
SUBMITTEDDeclaration submitted (this status is recorded when the order has been sent to customs, the merchant submits a new declaration, and customs provides a modification API)
PROCESSINGDeclaration in progress
SUCCESSDeclaration successful
FAILDeclaration failed
EXCEPTCustoms API error