Blogger Information
Blog 60
fans 0
comment 0
visits 100935
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
寄快递api接口-顺丰,中通,圆通,申通,韵达,京东,德邦,百世,天天一次性接入
快递100API
Original
1768 people have browsed it

为了让各位更快地接入顺丰,中通,圆通,申通,韵达,京东,德邦,百世,天天等主流快递公司,大家可以把源码复制到你的项目上,将源码里的参数改成自己的账户参数就能直接使用了。

此篇java demo方便开发者实现:运营前端只需要一个账户就能根据客户需求或快递运力情况选择多家快递公司预约快递公司上门取件(折扣价方式)

快递寄件API说明

商家寄件服务是专为寄件企业提供的一套解决方案。通过接口可以满足企业、电商、微商、快递网点、代收点等经常性寄件用户下单后,快递公司上门收件的需求。

若需要个人的预约寄件服务,请对接C端寄件接口:https://cloud.kuaidi100.com/marketDetail?id=32164354057 该接口免费,快递费用由寄件客户和快递员结算。

商家寄件API支持快递公司说明

支持的快递公司:

1、商家寄件(优选快递)支持中通、圆通、百世、天天、韵达、极兔、宅急送等快递公司的寄件下单。

2、商家寄件(官方快递)支持德邦、京东、圆通和申通。

运力及运费区别:

1、 优选快递:不保证寄件地址的运力,根据寄件地址的不同,支持的快递公司会有变化;阶梯运费价格,在对接接口前请查看寄件运力及寄件价格: https://api.kuaidi100.com/product/expressprice/

2、官方快递:可以保证全国地址的运力。运费是官方寄件价格的折扣价,具体运费价格请咨询在线客服或者右侧扫码咨询客户经理。

商家寄件查询运力示例代码:

  1. /**
  2. * 商家寄件查询运力
  3. */
  4. @Test
  5. public void testBorderQuery() throws Exception {
  6. BOrderQueryReq bOrderQueryReq = new BOrderQueryReq();
  7. bOrderQueryReq.setSendAddr("福田区华强南");
  8. String t = String.valueOf(System.currentTimeMillis());
  9. String param = new Gson().toJson(bOrderQueryReq);
  10. PrintReq printReq = new PrintReq();
  11. printReq.setKey(key);
  12. printReq.setSign(SignUtils.printSign(param,t,key,secret));
  13. printReq.setT(t);
  14. printReq.setParam(param);
  15. printReq.setMethod(ApiInfoConstant.B_ORDER_QUERY_TRANSPORT_CAPACITY_METHOD);
  16. IBaseClient bOrder = new BOrder();
  17. System.out.println(bOrder.execute(printReq));
  18. }

商家寄件示例代码:

  1. /**
  2. * 商家寄件
  3. */
  4. @Test
  5. public void testBorder() throws Exception {
  6. PrintReq printReq = new PrintReq();
  7. BOrderReq bOrderReq = new BOrderReq();
  8. bOrderReq.setKuaidicom(CompanyConstant.ZT);
  9. bOrderReq.setSendManName("张三");
  10. bOrderReq.setSendManMobile("15966666666");
  11. bOrderReq.setSendManPrintAddr("广东深圳市福田区华强南");
  12. bOrderReq.setRecManName("李四");
  13. bOrderReq.setRecManMobile("15966666666");
  14. bOrderReq.setRecManPrintAddr("广东深圳市南山区金蝶软件园");
  15. bOrderReq.setCallBackUrl("http://www.baidu.com");
  16. bOrderReq.setCargo("文件");
  17. bOrderReq.setRemark("测试下单,待会取消");
  18. bOrderReq.setWeight("1");
  19. bOrderReq.setSalt("123456");
  20. bOrderReq.setServiceType("标准快递");
  21. String t = String.valueOf(System.currentTimeMillis());
  22. String param = new Gson().toJson(bOrderReq);
  23. printReq.setKey(key);
  24. printReq.setSign(SignUtils.printSign(param,t,key,secret));
  25. printReq.setT(t);
  26. printReq.setParam(param);
  27. printReq.setMethod(ApiInfoConstant.B_ORDER_SEND_METHOD);
  28. IBaseClient bOrder = new BOrder();
  29. System.out.println(bOrder.execute(printReq));
  30. }

商家寄件获取验证码示例代码:

  1. /**
  2. * 商家寄件获取验证码
  3. */
  4. @Test
  5. public void testBorderGetCode() throws Exception {
  6. PrintReq printReq = new PrintReq();
  7. BOrderGetCodeReq bOrderGetCodeReq = new BOrderGetCodeReq();
  8. bOrderGetCodeReq.setTaskId("4D07550D8E685E06B3C679632E68ACDD");
  9. bOrderGetCodeReq.setOrderId("100012022010566");
  10. String t = String.valueOf(System.currentTimeMillis());
  11. String param = new Gson().toJson(bOrderGetCodeReq);
  12. printReq.setKey(key);
  13. printReq.setSign(SignUtils.printSign(param,t,key,secret));
  14. printReq.setT(t);
  15. printReq.setParam(param);
  16. printReq.setMethod(ApiInfoConstant.B_ORDER_CODE_METHOD);
  17. IBaseClient bOrder = new BOrder();
  18. System.out.println(bOrder.execute(printReq));
  19. }

取消商家寄件命令示例代码:

  1. /**
  2. * 取消商家寄件命令
  3. */
  4. @Test
  5. public void testBorderCancel() throws Exception {
  6. PrintReq printReq = new PrintReq();
  7. BOrderCancelReq bOrderCancelReq = new BOrderCancelReq();
  8. bOrderCancelReq.setTaskId("4D07550D8E685E06B3C679632E68ACDD");
  9. bOrderCancelReq.setOrderId("100012022010566");
  10. bOrderCancelReq.setCancelMsg("测试单取消");
  11. String t = String.valueOf(System.currentTimeMillis());
  12. String param = new Gson().toJson(bOrderCancelReq);
  13. printReq.setKey(key);
  14. printReq.setSign(SignUtils.printSign(param,t,key,secret));
  15. printReq.setT(t);
  16. printReq.setParam(param);
  17. printReq.setMethod(ApiInfoConstant.B_ORDER_CANCEL_METHOD);
  18. IBaseClient bOrder = new BOrder();
  19. System.out.println(bOrder.execute(printReq));
  20. }

C端查询运力示例代码:

  1. /**
  2. * C端查询运力
  3. */
  4. @Test
  5. public void testCOrderQuery() throws Exception {
  6. COrderQueryReq cOrderQueryReq = new COrderQueryReq();
  7. cOrderQueryReq.setAddress("广东省深圳市南山区华强南");
  8. cOrderQueryReq.setSecret_key(secret_key);
  9. cOrderQueryReq.setSecret_code(CloudApiCodeConstant.ORDER_QUERY_EXPRESS);
  10. cOrderQueryReq.setSecret_sign(SignUtils.cloudSign(secret_key, secret_secret));
  11. IBaseClient cloudBase = new CloudBase();
  12. System.out.println(cloudBase.execute(cOrderQueryReq));
  13. }

C端寄件示例代码:

  1. /**
  2. * c端寄件
  3. */
  4. @Test
  5. public void testCOrder() throws Exception {
  6. COrderReq cOrderReq = new COrderReq();
  7. cOrderReq.setCom(CompanyConstant.JD);
  8. cOrderReq.setSendManName("张三");
  9. cOrderReq.setSendManMobile("15966666666");
  10. cOrderReq.setSendManPrintAddr("广东深圳市南山区金蝶软件园");
  11. cOrderReq.setRecManName("李四");
  12. cOrderReq.setRecManMobile("15966666666");
  13. cOrderReq.setRecManPrintAddr("广东深圳市福田区华强南");
  14. cOrderReq.setCallBackUrl("http://www.baidu.com");
  15. cOrderReq.setCargo("文件");
  16. cOrderReq.setRemark("测试下单,待会取消");
  17. cOrderReq.setWeight("1");
  18. cOrderReq.setSalt("123456");
  19. cOrderReq.setSecret_key(secret_key);
  20. cOrderReq.setSecret_code(CloudApiCodeConstant.ORDER);
  21. cOrderReq.setSecret_sign(SignUtils.cloudSign(secret_key,secret_secret));
  22. IBaseClient cloudBase = new CloudBase();
  23. System.out.println(cloudBase.execute(cOrderReq));
  24. }

取消c端寄件命令示例代码:

  1. /**
  2. * c端取消寄件
  3. */
  4. @Test
  5. public void testCOrderCancel() throws Exception {
  6. COrderCancelReq cOrderCancelReq = new COrderCancelReq();
  7. cOrderCancelReq.setTaskId("B19BB4C6F33BE9E735A63D4142557751");
  8. cOrderCancelReq.setOrderId("11115207");
  9. cOrderCancelReq.setCancelMsg("测试单");
  10. cOrderCancelReq.setSecret_key(secret_key);
  11. cOrderCancelReq.setSecret_code(CloudApiCodeConstant.ORDER_CANCEL);
  12. cOrderCancelReq.setSecret_sign(SignUtils.cloudSign(secret_key,secret_secret));
  13. IBaseClient cloudBase = new CloudBase();
  14. System.out.println(cloudBase.execute(cOrderCancelReq));
  15. }
  16. }

官方技术支持:https://api.kuaidi100.com/document/5eb9f5b686b0df41883139f4.html

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post