Skip to content

Customs Declaration ​

Customs declaration is needed for products shipped directly to China from international merchants.

Declaration API ​

Customs declaration service currenly supports orders paid with UnionPay, AliPay and WeChatPay. If you want to use this service for WeChatPay, please contact us first for technical support.

shell
POST
https://api.nihaopay.com/v1.2/customs/declaration/{transaction_id}

Request

shell
$ curl https://api.nihaopay.com/v1.2/customs/declaration/20180529073648029764 \
-H "Authorization: Bearer <TOKEN>" \
-d request_no=20180529073648029702 \
-d customs=ningbo \
-d merchant_customs_code=440316T004 \
-d merchant_customs_name=财付通支付科技有限公司 \
-d customs_amount=1284 \
-d split=true \
-d product_amount=1284 \
-d transport_amount=0 \
-d sub_order_id=20180529073648029701

Request ​

PropertyDescription
request_no
String(36) Required
Request order number
customs
String(64) Required
Customs to send declaration to
merchant_customs_code
String(32) Required
The merchant customs recordation number
merchant_customs_name
String(64) Required
The merchant customs recordation name
customs_amount
Int Required
The declaration amount in RMB "fen (cent)", If the order is splitted, this field cannot be empty.
duty_amount
Int Optional
Customs duty in RMB "fen (cent)". Required by some customs
split
bool Required
Default: true
Splitting order? Default: true
sub_order_id
String(64) Required
Merchant's sub order number.
product_amount
Int Conditional
Product's value in RMB "fen(cent)". If the order is splitted, this field cannot be empty
transport_amount
Int Conditional
Shipping cost. If the order is splitted, this field cannot be empty
cert_type
String(16) Required
Certification type. Only supports Chinese Mainland ID for now. Default: ID_CARD
cert_name
String(64) Required
Name on certificate
cert_no
String(32) Required
Chinese mainland ID number (please captalize the trailling X)

Request parameter desciption ​

You can declare through the following customs:

  • ZONGSHU:General Administration of Customs
  • BEIJING:Beijing Customs
  • HANGZHOU:Hangzhou Customs
  • NINGBO:Ningbo Customs
  • GUANGZHOU:Guangzhou Customs
  • GUANGZHOU_HUANGPU:Guangzhou Huangpu Customs
  • SHENZHEN:Shenzhen Customs
  • NANSHA:Nansha Guo Jian
  • ZHENGZHOU:Zhenzhou Customs(Henan bonded logistics center)
  • XINZHENG:Xinzheng comprehensive free trade zone (Airport)
  • CHONGQING:Chongqing Customs
  • SHANGHAI:Shanghai Customs
  • XIAN:Xi'an Customs
  • TIANJING:Tianjin Customs
  • XIAMEN: Xiamen Customs

Response

json
{
    "id": "20180529084416000000",
    "status": "pending",
    "transaction_id": "20180529073648029764",
    "pay_transaction_id": "2019011122001376840500835544",
    "ver_dept": 2,
    "pay_code": "312226T001",
    "cert_check": "UNCHECKED"
}

Response ​

PropertyDescription
id
string
Serial number for customs declaration, generated by NihaoPay
status
string
Customs declaration status: success, failure, pending.
transaction_id
string
Transaction ID
pay_transaction_id
string
A unique number assigned by payment provider
ver_dept
int
The organization that verifies the transaction can be: 0-UnionPay,1-NetsUnion,2-Other
pay_code
string
The customs registration number of payment provider.
cert_check
string
Verification result of the purchaser and payer identity information. SAME - Identity information is matched; DIFFERENT - Identity information is not matched; UNCHECKED - Unchecked or no purchaser identification information provided.

Customs code ​

UnionPay's customs registration info:

  • Customs Name:中国银联股份有限公司
  • Customs code:312228034U

WeChatPay's customs registration info:

  • Customs Name:财付通支付科技有限公司
  • Customs Code:4403169D3W

AliPay's customs registration info:

  • Customs Name:支付宝(中国)网络技术有限公司
CustomsCustoms Code
ZONGSHU31222699S7
SHANGHAI31222699S7
NINGBO31222699S7
ZHENGZHOU31222699S7
XINZHENGP460400005
HANGZHOUZF14021901
GUANGZHOUC000010000416158
TIANJINQ12150016000019

Declaration query ​

shell
GET
https://api.nihaopay.com/v1.2/customs/{request_no}

Request

shell
$ curl https://api.nihaopay.com/v1.2/customs/20180529073648029702 \
-H "Authorization: Bearer <TOKEN>"

Request ​

PropertyDescription
request_no
Required
Request order number

Response

json
{
    "id": "20180529084416000000",
    "request_no": "20180529073648029702",
    "status": "pending",
    "vendor_id": "4200000112201805292728213273",
    "customs": "NINGBO",
    "split": true,
    "customs_amount": 1284,
    "product_amount": 1284,
    "transport_amount": 0,
    "transaction_id": "20180529073648029764",
    "sub_order_id": "20180529073648029701",
    "pay_transaction_id": "2019011122001376840500835544",
    "ver_dept": 2,
    "pay_code": "312226T001"
}

Response ​

PropertyDescription
id
string
Declaration status request ID
transaction_id
string
Original transaction ID
vendor_id
string
Vendor's serial number of original transaction
status
string
Customs declaration status: success, failure, pending.
customs
string
Customs the declaration is sent to
customs_amount
int
Same with request
duty_amount
int
Same with request
split
bool
Splitting order
sub_order_id
string
Same with request
product_amount
int
Same with request
transport_amount
int
Same with request
pay_transaction_id
string
A unique number assigned by payment provider
ver_dept
int
The organization that verifies the transaction can be: 0-UnionPay,1-NetsUnion,2-Other
pay_code
string
The customs registration number of payment provider.

Redeclaration ​

shell
POST
https://api.nihaopay.com/v1.2/customs/redeclaration/{request_no}

Request

shell
$ curl https://api.nihaopay.com/v1.2/customs/redeclaration/20210810150833001421 \
-H "Authorization: Bearer <TOKEN>"

Request ​

PropertyDescription
request_no
Required
Request order number

Response

json
{
    "transaction_id": "20210810150833001421",
    "cert_check": "DIFFERENT",
    "ver_dept": 3,
    "request_no": "20210810150833001421",
    "pay_code": "31222699S7",
    "pay_transaction_id": "2021081011082640020055578",
    "merchant_id": "M001100001",
    "id": "20210810150935000155",
    "status": "success"
}

Response ​

PropertyDescription
request_no
string
Request order number
id
string
Declaration status request ID
merchant_id
string
NihaoPay Merchant ID
transaction_id
string
Original transaction ID
status
string
Customs declaration status: success, failure, pending.
pay_transaction_id
string
A unique number assigned by payment provider
ver_dept
int
The organization that verifies the transaction can be: 0-UnionPay,1-NetsUnion,2-Other
pay_code
string
The customs registration number of payment provider.
cert_check
string
Verification result of the purchaser and payer identity information. SAME - Identity information is matched; DIFFERENT - Identity information is not matched; UNCHECKED - Unchecked or no purchaser identification information provided.

Error code for Customs Declaration ​

codelabelmessage
40031Transaction reference number must be unique. Please re-submit.
40261Transaction not found.
50081Merchant config error
50082Merchant unavailable
40090The field not valid.
50091Signature error
50092The {0} field is required.
50096Timeout
50097Inner error
50098Vendor error
50099System error
401301Invalid merchant credentials provided
402100Transaction retransmission fail, Please try it after 5 minutes.
402101Customs not supported.
402102Customs infomation changed.
402103Certification not correct.
402104Split amount not correct.
402105Can not be modified as it is on declaration.
402106Same customs declare once.
402107Your request has been submitted, please confirm that it has taken effect.
402108The original customs does not exist
402109The declaration is not allowed for refunded orders

Last Updated - 01/16/2025