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=20180529073648029701Request
| Property | Description |
|---|---|
| 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 RequiredDefault: 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
| Property | Description |
|---|---|
idstring | Serial number for customs declaration, generated by NihaoPay |
statusstring | Customs declaration status: success, failure, pending. |
transaction_idstring | Transaction ID |
pay_transaction_idstring | A unique number assigned by payment provider |
ver_deptint | The organization that verifies the transaction can be: 0-UnionPay,1-NetsUnion,2-Other |
pay_codestring | The customs registration number of payment provider. |
cert_checkstring | 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:支付宝(中国)网络技术有限公司
| Customs | Customs Code |
|---|---|
| ZONGSHU | 31222699S7 |
| SHANGHAI | 31222699S7 |
| NINGBO | 31222699S7 |
| ZHENGZHOU | 31222699S7 |
| XINZHENG | P460400005 |
| HANGZHOU | ZF14021901 |
| GUANGZHOU | C000010000416158 |
| TIANJIN | Q12150016000019 |
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
| Property | Description |
|---|---|
request_noRequired | 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
| Property | Description |
|---|---|
idstring | Declaration status request ID |
transaction_idstring | Original transaction ID |
vendor_idstring | Vendor's serial number of original transaction |
statusstring | Customs declaration status: success, failure, pending. |
customsstring | Customs the declaration is sent to |
customs_amountint | Same with request |
duty_amountint | Same with request |
splitbool | Splitting order |
sub_order_idstring | Same with request |
product_amountint | Same with request |
transport_amountint | Same with request |
pay_transaction_idstring | A unique number assigned by payment provider |
ver_deptint | The organization that verifies the transaction can be: 0-UnionPay,1-NetsUnion,2-Other |
pay_codestring | 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
| Property | Description |
|---|---|
request_noRequired | 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
| Property | Description |
|---|---|
request_nostring | Request order number |
idstring | Declaration status request ID |
merchant_idstring | NihaoPay Merchant ID |
transaction_idstring | Original transaction ID |
statusstring | Customs declaration status: success, failure, pending. |
pay_transaction_idstring | A unique number assigned by payment provider |
ver_deptint | The organization that verifies the transaction can be: 0-UnionPay,1-NetsUnion,2-Other |
pay_codestring | The customs registration number of payment provider. |
cert_checkstring | 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
| code | label | message |
|---|---|---|
| 400 | 31 | Transaction reference number must be unique. Please re-submit. |
| 402 | 61 | Transaction not found. |
| 500 | 81 | Merchant config error |
| 500 | 82 | Merchant unavailable |
| 400 | 90 | The field not valid. |
| 500 | 91 | Signature error |
| 500 | 92 | The {0} field is required. |
| 500 | 96 | Timeout |
| 500 | 97 | Inner error |
| 500 | 98 | Vendor error |
| 500 | 99 | System error |
| 401 | 301 | Invalid merchant credentials provided |
| 402 | 100 | Transaction retransmission fail, Please try it after 5 minutes. |
| 402 | 101 | Customs not supported. |
| 402 | 102 | Customs infomation changed. |
| 402 | 103 | Certification not correct. |
| 402 | 104 | Split amount not correct. |
| 402 | 105 | Can not be modified as it is on declaration. |
| 402 | 106 | Same customs declare once. |
| 402 | 107 | Your request has been submitted, please confirm that it has taken effect. |
| 402 | 108 | The original customs does not exist |
| 402 | 109 | The declaration is not allowed for refunded orders |
