提供给商户跨境支付海关报关的功能
| 测试请求地址 | https://cbtrxtest.helipay.com/cbtrx/rest/applyCustoms/apply |
| 请求地址 | https://cbptrx.helipay.com/cbtrx/rest/applyCustoms/apply |
| 提交方式 | 采用POST方法提交,requestbody传值 Content-Type=[application/json;charset=UTF-8] |
| 签名算法 | UTF-8字符编码 SHA256签名 AES加密 |
| 名称 | 参数 | 类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|---|
| 产品编码 | productCode | String(20) | 是 | APPLYCUSTOMS | |
| 商户订单号 | orderNo | String(64) | 是 | p_20170302185347 | 报关请求号,每笔报关请求唯一,商户自定义 |
| 商户编号 | merchantNo | String(10) | 是 | Me10000002 | 合利宝-跨境系统分配的商户编号 |
| 支付产品编码 | payProductCode | String(20) | 是 | ALIPAYSCAN | 商户请求[网银,快捷,扫码,会员支付等接口]的 productCode 字段 |
| 原始订单号 | payOrderNo | String(64) | 是 | p_20170202185447 | 商户请求[网银,快捷,扫码,会员支付等接口]的 orderNo 字段 |
| 订购人 | payerName | String(15) | 否 | 张三 | |
| 订购人身份证 | idCardNo | String(15) | 否 | 123456789012345678 | |
| 订购人手机号 | phone | String(15) | 否 | 18810987654 | |
| 下单ip | orderIp | String(15) | 否 | 1.1.1.1 | |
| 回调地址 | callbackUrl | Strin(300) | 否 | http://www.456.com | |
| 报关明细 | detailList | List | 是 | 详见下面说明 | 同一关口有多个商品需要报关,只需写一条明细 |
| 名称 | 参数 | 类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|---|
| 排序参数 | index | Integer | 是 | ||
| 商品名称 | goodsName | String(400) | 是 | 奶粉 | |
| 商品数量 | goodsNum | Integer | 是 | 2 | |
| 商品单价 | goodsItemAmount | Number(10.2) | 是 | 50.00 | 单位:元 |
| 支付金额 | orderAmount | Number(10.2) | 是 | 125.00 | 单位:元;-1<=支付金额+折扣金额-(货款+税款+运费)<=1;支付金额不能大于原订单金额 |
| 折扣金额 | discountAmount | Number(10.2) | 否 | 0.98 | 单位:元 |
| 支付货款 | goodsAmount | Number(10.2) | 是 | 100.00 | 单位:元 |
| 支付运费 | freight | Number(10.2) | 是 | 20.00 | 单位:元 |
| 支付税款 | tax | Number(10.2) | 是 | 5.00 | 单位:元 |
| 海关通道 | customsType | String(20) | 是 | GUANGZHOU | 前往附录查看《海关国检编码》 |
| 海关企业备案号 | merchantCommerceCode | String(50) | 是 | C123456789 | 报关企业在报关平台的备案号 |
| 海关企业备案名称 | merchantCommerceName | String(200) | 是 | 报关企业 | 报关企业在海关的备案名称 |
| 国检通道 | inspectionType | String(20) | 否 | GUANGZHOUNS | GUANGZHOUNS-广州南沙;目前支持广州南沙国检 |
| 国检企业备案号 | merchantInspectionCode | String(50) | 否 | C123456789 | 报关企业在国检平台的备案号,国检通道不为空时必录 |
| 国检企业备案名称 | merchantInspectionName | String(200) | 否 | 报关企业 | 报关企业在国检的备案名称 |
| 备注 | summary | String(200) | 否 | ||
| 拆单订单号 | splitOrderNo | String(64) | 否 |
| 名称 | 参数 | 类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|---|
| 产品编码 | productCode | String(20) | 是 | APPLYCUSTOMS | |
| 商户订单号 | orderNo | String(64) | 是 | p_20170302185347 | |
| 商户编号 | merchantNo | String(10) | 是 | Me10000002 | 合利宝-跨境系统分配的商户编号 |
| 支付产品编码 | payProductCode | String(20) | 是 | ONLINEB2B | 报关订单对应的实际支付订单的产品编码 |
| 原始订单号 | payOrderNo | String(64) | 是 | p_20170202185447 | 商户原交易订单的商户订单号(请求合利宝的订单号) |
| 响应码 | errorCode | String(10) | 是 | 0000 | 0000 代表请求成功 |
| 响应信息 | errorMessage | String(200) | 否 | 成功 | 响应信息 错误信息 |
| 响应时间 | current | String(20) | 是 | 2018-04-01 12:00:00 | 格式yyyy-MM-dd HH:mm:ss |
| 报关明细 | detailList | List | 否 | 详见下面说明 | 不同的海关国检的情况 |
| 名称 | 参数 | 类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|---|
| 海关通道 | customsType | String(20) | 否 | GUANGZHOU | |
| 国检通道 | inspectionType | String(20) | 否 | ||
| 平台流水号 | serialNumber | String(32) | 否 | 201702241400010002 | 合利宝-跨境系统生成的唯一交易流水号 |
| 下单时间 | createDate | String(20) | 否 | 2018-04-01 12:00:00 | 格式yyyy-MM-dd HH:mm:ss |
| 完成时间 | finishDate | String(20) | 否 | 2018-04-01 12:00:00 | 格式yyyy-MM-dd HH:mm:ss |
| 订单状态 | orderStatus | String(20) | 否 | INIT | INIT: 待报送(实名认证及扣费成功); FAIL: 失败(实名认证失败); CUSTOMSSEND: 海关已报国检无须报; CUSSENDINSNO: 海关已报国检待报; CUSSENDINSSEND: 海关已报国检已报; PUSHAPPLYBLOCK: 风控阻断; CANCELED: 取消; |
| 支付金额 | orderAmount | Number(10.2) | 否 | 125.00 | 单位:元 |
| 折扣金额 | discountAmount | Number(10.2) | 否 | 0.98 | 单位:元 |
| 支付货款 | goodsAmount | Number(10.2) | 否 | 100.00 | 单位:元 |
| 支付运费 | freight | Number(10.2) | 否 | 20.00 | 单位:元 |
| 支付税款 | tax | Number(10.2) | 否 | 5.00 | 单位:元 |
| 拆单支付单号 | splitPaySerialNumber | String(64) | 否 | ||
| 排序参数 | index | Integer | 否 | 1 |
@Test
public void applyCustoms() {
RemoteServiceImpl remoteService = new RemoteServiceImpl();
HeliRequest heliRequest = remoteService.postRemoteInvoke(LoadPropertiesUtils.getProperty("applyCustomsUrl"),
installDto(), HeliRequest.class);
ApplycustomsResponseForm form = decode(heliRequest,
ApplycustomsResponseForm.class,heliRequest.getProductCode(),heliRequest.getMerchantNo());
logger.info("#####解密后的内容为{}", form.toString());
}
public static String installDto() {
ApplycustomsRequestForm applycustomsRequestForm = new ApplycustomsRequestForm();
applycustomsRequestForm.setMerchantNo(LoadPropertiesUtils.getProperty("merchantNo"));
applycustomsRequestForm.setProductCode(ProductEnumType.APPLYCUSTOMS.name());
applycustomsRequestForm.setOrderNo("APPLYCUSTOMS304530011523456");
applycustomsRequestForm.setPayProductCode(ProductEnumType.ALIPAYSCAN.name());
applycustomsRequestForm.setPayOrderNo("ALIPAYSCAN061502");
//报关明细请求参数:
List detailList = new ArrayList<>();
//报关明细请求参数1(录入国检):
ApplycustomsRequestDetail applycustomsRequestDetail = new ApplycustomsRequestDetail();
//必填项
//排序参数不为空
applycustomsRequestDetail.setIndex(1);
//商品名称不为空
applycustomsRequestDetail.setGoodsName("苹果");
//商品数量不为空
applycustomsRequestDetail.setGoodsNum(1);
//商品单价不为空
applycustomsRequestDetail.setGoodsItemAmount(new BigDecimal("1"));
applycustomsRequestDetail.setOrderAmount(new BigDecimal("0.5"));
//支付运费不为空
applycustomsRequestDetail.setFreight(new BigDecimal("0.1"));
//支付货款不为空
applycustomsRequestDetail.setGoodsAmount(new BigDecimal("0.2"));
//折扣金额 若有,需要传递
applycustomsRequestDetail.setGoodsAmount(new BigDecimal("0.2"));
//支付税款不为空
applycustomsRequestDetail.setTax(new BigDecimal("0.2"));
//海关通道不为空
applycustomsRequestDetail.setCustomsType("HANGZHOU");
//海关企业备案号不为空
applycustomsRequestDetail.setMerchantCommerceCode("");
//海关企业备案名称不为空
applycustomsRequestDetail.setMerchantCommerceName("");
//选填项
//国检通道
applycustomsRequestDetail.setInspectionType("");
//国检企业备案号
applycustomsRequestDetail.setMerchantInspectionCode("");
//国检企业备案名称
applycustomsRequestDetail.setMerchantInspectionName("");
//备注
applycustomsRequestDetail.setSummary("需要国检");
//报关明细请求参数2(不录入国检):
ApplycustomsRequestDetail applycustomsRequestDetail1 = new ApplycustomsRequestDetail();
//必填项
applycustomsRequestDetail1.setGoodsName("IPHONE");
//排序参数不为空
applycustomsRequestDetail1.setIndex(2);
//商品数量不为空
applycustomsRequestDetail1.setGoodsNum(1);
//商品单价不为空
applycustomsRequestDetail1.setGoodsItemAmount(new BigDecimal("1"));
applycustomsRequestDetail1.setOrderAmount(new BigDecimal("0.5"));
//支付运费不为空
applycustomsRequestDetail1.setFreight(new BigDecimal("0.2"));
//支付货款不为空
applycustomsRequestDetail1.setGoodsAmount(new BigDecimal("0.2"));
//支付税款不为空
applycustomsRequestDetail1.setTax(new BigDecimal("0.1"));
//海关通道不为空
applycustomsRequestDetail1.setCustomsType("NINGBO");
//海关企业备案号不为空
applycustomsRequestDetail1.setMerchantCommerceCode("");
//海关企业备案名称不为空
applycustomsRequestDetail1.setMerchantCommerceName("");
//选填项
//国检通道
applycustomsRequestDetail.setInspectionType("");
//国检企业备案号
applycustomsRequestDetail.setMerchantInspectionCode("");
//国检企业备案名称
applycustomsRequestDetail.setMerchantInspectionName("");
//备注
applycustomsRequestDetail.setSummary("");
//拆单订单号
applycustomsRequestDetail.setSplitOrderNo(System.currentTimeMillis() + "");
detailList.add(applycustomsRequestDetail);
detailList.add(applycustomsRequestDetail1);
applycustomsRequestForm.setDetailList(detailList);
//选填项
applycustomsRequestForm.setOrderIp("127.0.0.1");
applycustomsRequestForm.setCallbackUrl("www.baidu.com");
return
JSONObject.toJSONString(encodeAndSign(applycustomsRequestForm,applycustomsRequestForm.getProductCode(),applycustomsRequestForm.getMerchantNo()));
}
| 错误码 | 错误码描述 | 解决方案 |
|---|---|---|