Skip to content

报关 ​

报关产品是为跨境电商行业商户提供直邮中国业务场景下支付单海关申报的服务。

报关接口 ​

目前支持使用银联,支付宝和微信付款的订单做海关申报,如果开通微信支付的商户,需要使用报关产品前请先将海关备案号和海关备案名称邮件发送至业务支持团队,避免出现报关失败的问题。

身份信息校验申报规则:

  • 身份信息校验不管是否一致,微信或支付宝都以系统登记的支付人信息推送海关
  • 商户重推上传新的用户身份信息,渠道会重新校验
shell
POST
https://api.nihaopay.com/v1.2/customs/declaration/{transaction_id}

请求示例

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_no
String(36) 不为空
请求订单号
customs
String(64) 不为空
申报海关
merchant_customs_code
String(32) 不为空
商户海关备案号
merchant_customs_name
String(64) 不为空
商户海关备案名称
customs_amount
Int 不为空
报关人民币金额,以分为单位
duty_amount
Int 允许为空
关税,以分为单位。部分海关需要上报关税信息
description
String(128) 允许为空
报关信息描述
split
bool 不为空
是否拆单,默认为true
sub_order_id
String(64) 不为空
商户子订单号,用于在海关系统中匹配物流单和订单信息
product_amount
Int 有条件的
商品金额,以分为单位。在拆单情况下,该字段不能为空
transport_amount
Int 有条件的
物流费用,以分为单位。在拆单情况下,该字段不能为空
cert_type
String(16) 不为空
订购人证件类型,目前只支持大陆身份证,默认固定值ID_CARD
cert_name
String(64) 不为空
订购人姓名,如张三
cert_no
String(32) 不为空
用户大陆身份证号,尾号为X的,请用大写字母X。

请求参数说明 ​

支持的申报海关包括:

  • ZONGSHU:海关总署
  • BEIJING:北京海关
  • HANGZHOU:杭州海关
  • NINGBO:宁波海关
  • GUANGZHOU:广州海关
  • GUANGZHOU_HUANGPU:广州黄埔国检
  • SHENZHEN:深圳海关
  • NANSHA:南沙国检
  • ZHENGZHOU:河南保税物流中心
  • XINZHENG:新郑综合保税区
  • CHONGQING:重庆海关
  • SHANGHAI:上海海关
  • XIAN:西安海关
  • TIANJING:天津海关
  • XIAMEN:厦门海关

返回示例

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

返回报文 ​

字段说明
id
string
NihaoPay生成的报关流水号.
status
string
报关状态. 包括:成功 success, 失败failure, 报关中pending.
transaction_id
string
原交易流水号.
pay_transaction_id
string
支付流水号,来自支付机构,如微信或者支付宝的交易交易流水号,供商户海关报备使用
ver_dept
int
核验机构,包括 0-银联,1-网联,2-其他
pay_code
string
支付企业的海关注册登记编号
cert_check
string
订购人和支付人身份信息校验结果,UNCHECKED:商户未上传订购人身份信息,SAME:商户上传的订购人身份信息与支付人身份信息一致,DIFFERENT:商户上传的订购人身份信息与支付人身份信息不一致

支付企业海关注册编号 ​

银联付款的订单对应的支付企业海关信息如下:

  • 备案名称:中国银联股份有限公司
  • 备案编号:312228034U

微信付款的订单对应的支付企业海关信息如下:

  • 备案名称:财付通支付科技有限公司
  • 备案编号:4403169D3W

支付宝付款的订单对应的支付企业海关信息如下:

  • 备案名称:支付宝(中国)网络技术有限公司
海关支付宝备案号
总署31222699S7
上海海关31222699S7
宁波海关31222699S7
河南保税物流中心31222699S7
新郑综合保税区P460400005
杭州海关ZF14021901
广州海关C000010000416158
天津海关Q12150016000019

报关查询接口 ​

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

请求示例

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

请求报文 ​

字段说明
request_no
不为空
需要查询的报关请求单号

返回示例

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"
}

返回报文 ​

字段说明
id
string
报关请求ID
transaction_id
string
原支付交易ID
vendor_id
string
原支付交易在渠道方的流水号
status
string
报关状态, 包括:成功 success, 失败failure, 报关中pending.
customs
string
申报海关
customs_amount
int
报关人民币金额,以分为单位
duty_amount
int
关税,以分为单位。部分海关需要上报关税信息
split
bool
是否拆单,默认为不拆单
sub_order_id
string
商户子订单号,在拆单情况下,该字段不能为空
product_amount
int
商品金额,以分为单位。在拆单情况下,该字段不能为空
transport_amount
int
物流费用,以分为单位。在拆单情况下,该字段不能为空
pay_transaction_id
string
支付流水号,来自支付机构,如微信或者支付宝的交易交易流水号,供商户海关报备使用
ver_dept
int
核验机构,包括 0-银联,1-网联,2-其他
pay_code
string
支付企业的海关注册登记编号

报关重推接口 ​

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

请求示例

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

请求报文 ​

字段说明
request_no
不为空
需要重推的报关请求单号

返回示例

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"
}

返回报文 ​

字段说明
request_no
string
原报关请求订单号
id
string
NihaoPay生成的报关流水号.
merchant_id
string
NihaoPay的商户号
status
string
报关状态. 包括:成功 success, 失败failure, 报关中pending.
transaction_id
string
原交易流水号.
pay_transaction_id
string
支付流水号,来自支付机构,如微信或者支付宝的交易交易流水号,供商户海关报备使用
ver_dept
int
核验机构,包括 0-银联,1-网联,2-其他
pay_code
string
支付企业的海关注册登记编号
cert_check
string
订购人和支付人身份信息校验结果,UNCHECKED:商户未上传订购人身份信息,SAME:商户上传的订购人身份信息与支付人身份信息一致,DIFFERENT:商户上传的订购人身份信息与支付人身份信息不一致

报关接口错误码列表 ​

codelabelmessage
40031Transaction reference number must be unique. Please re-submit.商户订单号不能重复,请更换订单号后重新提交
40261Transaction not found.交易未找到
50081Merchant config error 商户配置错误,请联系NihaoPay
50082Merchant unavailable 商户不可用
40090The field not valid. 请求参数格式不正确
50091Signature error 签名错误
50092The {0} field is required.请求字段不能为空
50096Timeout 请求超时
50097Inner error 内部错误
50098Vendor error 渠道系统出错,请稍后再试
50099System error 系统错误,请联系NihaoPay
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. 已退款订单不能申报

最后更新 - 01/16/2025