为了让各位更快地接入顺丰, 中通, 圆通, 申通, 韵达, 京东, 德邦, 百世, 天天等支流快递公司,大家能够把源码复制到你的我的项目上,将源码里的参数改成本人的账户参数就能间接应用了。
此篇 java demo 不便开发者实现:经营前端只须要一个账户就能依据客户需要或快递运力状况抉择多家快递公司预约快递公司上门取件(折扣价形式)
快递寄件 API 阐明
商家寄件服务是专为寄件企业提供的一套解决方案。通过接口能够满足企业、电商、微商、快递网点、代收点等经常性寄件用户下单后,快递公司上门收件的需要。
若须要集体的预约寄件服务,请对接 C 端寄件接口:https://cloud.kuaidi100.com/marketDetail?id=32164354057 该接口收费,快递费用由寄件客户和快递员结算。
商家寄件 API 反对快递公司阐明
反对的快递公司:
1、商家寄件(优选快递)反对中通、圆通、百世、天天、韵达、极兔、宅急送等快递公司的寄件下单。
2、商家寄件(官网快递)反对德邦、京东、圆通和申通。
运力及运费区别:
1、优选快递:不保障寄件地址的运力,依据寄件地址的不同,反对的快递公司会有变动;阶梯运费价格,在对接接口前请查看寄件运力及寄件价格:https://api.kuaidi100.com/product/expressprice/;
2、官网快递:能够保障全国地址的运力。运费是官网寄件价格的折扣价,具体运费价格请征询在线客服或者右侧扫码征询客户经理。
商家寄件查问运力示例代码:
/**
* 商家寄件查问运力
*/
@Test
public void testBorderQuery() throws Exception {BOrderQueryReq bOrderQueryReq = new BOrderQueryReq();
bOrderQueryReq.setSendAddr("福田区华强南");
String t = String.valueOf(System.currentTimeMillis());
String param = new Gson().toJson(bOrderQueryReq);
PrintReq printReq = new PrintReq();
printReq.setKey(key);
printReq.setSign(SignUtils.printSign(param,t,key,secret));
printReq.setT(t);
printReq.setParam(param);
printReq.setMethod(ApiInfoConstant.B_ORDER_QUERY_TRANSPORT_CAPACITY_METHOD);
IBaseClient bOrder = new BOrder();
System.out.println(bOrder.execute(printReq));
}
商家寄件 示例代码:
/**
* 商家寄件
*/
@Test
public void testBorder() throws Exception {PrintReq printReq = new PrintReq();
BOrderReq bOrderReq = new BOrderReq();
bOrderReq.setKuaidicom(CompanyConstant.ZT);
bOrderReq.setSendManName("张三");
bOrderReq.setSendManMobile("15966666666");
bOrderReq.setSendManPrintAddr("广东深圳市福田区华强南");
bOrderReq.setRecManName("李四");
bOrderReq.setRecManMobile("15966666666");
bOrderReq.setRecManPrintAddr("广东深圳市南山区金蝶软件园");
bOrderReq.setCallBackUrl("http://www.baidu.com");
bOrderReq.setCargo("文件");
bOrderReq.setRemark("测试下单,待会勾销");
bOrderReq.setWeight("1");
bOrderReq.setSalt("123456");
bOrderReq.setServiceType("规范快递");
String t = String.valueOf(System.currentTimeMillis());
String param = new Gson().toJson(bOrderReq);
printReq.setKey(key);
printReq.setSign(SignUtils.printSign(param,t,key,secret));
printReq.setT(t);
printReq.setParam(param);
printReq.setMethod(ApiInfoConstant.B_ORDER_SEND_METHOD);
IBaseClient bOrder = new BOrder();
System.out.println(bOrder.execute(printReq));
}
商家寄件获取验证码 示例代码:
/**
* 商家寄件获取验证码
*/
@Test
public void testBorderGetCode() throws Exception {PrintReq printReq = new PrintReq();
BOrderGetCodeReq bOrderGetCodeReq = new BOrderGetCodeReq();
bOrderGetCodeReq.setTaskId("4D07550D8E685E06B3C679632E68ACDD");
bOrderGetCodeReq.setOrderId("100012022010566");
String t = String.valueOf(System.currentTimeMillis());
String param = new Gson().toJson(bOrderGetCodeReq);
printReq.setKey(key);
printReq.setSign(SignUtils.printSign(param,t,key,secret));
printReq.setT(t);
printReq.setParam(param);
printReq.setMethod(ApiInfoConstant.B_ORDER_CODE_METHOD);
IBaseClient bOrder = new BOrder();
System.out.println(bOrder.execute(printReq));
}
勾销商家寄件命令 示例代码:
/**
* 勾销商家寄件命令
*/
@Test
public void testBorderCancel() throws Exception {PrintReq printReq = new PrintReq();
BOrderCancelReq bOrderCancelReq = new BOrderCancelReq();
bOrderCancelReq.setTaskId("4D07550D8E685E06B3C679632E68ACDD");
bOrderCancelReq.setOrderId("100012022010566");
bOrderCancelReq.setCancelMsg("测试单勾销");
String t = String.valueOf(System.currentTimeMillis());
String param = new Gson().toJson(bOrderCancelReq);
printReq.setKey(key);
printReq.setSign(SignUtils.printSign(param,t,key,secret));
printReq.setT(t);
printReq.setParam(param);
printReq.setMethod(ApiInfoConstant.B_ORDER_CANCEL_METHOD);
IBaseClient bOrder = new BOrder();
System.out.println(bOrder.execute(printReq));
}
C 端查问运力 示例代码:
/**
* C 端查问运力
*/
@Test
public void testCOrderQuery() throws Exception {COrderQueryReq cOrderQueryReq = new COrderQueryReq();
cOrderQueryReq.setAddress("广东省深圳市南山区华强南");
cOrderQueryReq.setSecret_key(secret_key);
cOrderQueryReq.setSecret_code(CloudApiCodeConstant.ORDER_QUERY_EXPRESS);
cOrderQueryReq.setSecret_sign(SignUtils.cloudSign(secret_key, secret_secret));
IBaseClient cloudBase = new CloudBase();
System.out.println(cloudBase.execute(cOrderQueryReq));
}
C 端寄件 示例代码:
/**
* c 端寄件
*/
@Test
public void testCOrder() throws Exception {COrderReq cOrderReq = new COrderReq();
cOrderReq.setCom(CompanyConstant.JD);
cOrderReq.setSendManName("张三");
cOrderReq.setSendManMobile("15966666666");
cOrderReq.setSendManPrintAddr("广东深圳市南山区金蝶软件园");
cOrderReq.setRecManName("李四");
cOrderReq.setRecManMobile("15966666666");
cOrderReq.setRecManPrintAddr("广东深圳市福田区华强南");
cOrderReq.setCallBackUrl("http://www.baidu.com");
cOrderReq.setCargo("文件");
cOrderReq.setRemark("测试下单,待会勾销");
cOrderReq.setWeight("1");
cOrderReq.setSalt("123456");
cOrderReq.setSecret_key(secret_key);
cOrderReq.setSecret_code(CloudApiCodeConstant.ORDER);
cOrderReq.setSecret_sign(SignUtils.cloudSign(secret_key,secret_secret));
IBaseClient cloudBase = new CloudBase();
System.out.println(cloudBase.execute(cOrderReq));
}
勾销 c 端寄件命令 示例代码:
/**
* c 端勾销寄件
*/
@Test
public void testCOrderCancel() throws Exception {COrderCancelReq cOrderCancelReq = new COrderCancelReq();
cOrderCancelReq.setTaskId("B19BB4C6F33BE9E735A63D4142557751");
cOrderCancelReq.setOrderId("11115207");
cOrderCancelReq.setCancelMsg("测试单");
cOrderCancelReq.setSecret_key(secret_key);
cOrderCancelReq.setSecret_code(CloudApiCodeConstant.ORDER_CANCEL);
cOrderCancelReq.setSecret_sign(SignUtils.cloudSign(secret_key,secret_secret));
IBaseClient cloudBase = new CloudBase();
System.out.println(cloudBase.execute(cOrderCancelReq));
}
}
官网技术支持:https://api.kuaidi100.com/document/5eb9f5b686b0df41883139f4.html