java快递寄件/打单api,一次接入顺丰,中通,圆通,申通,韵达,京东,德邦,百世,天天

快递100API

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

此篇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

阅读 189

API服务是快递100自主研发的企业级服务,提供各行业快递物流管理解决方案。基于专业的软、硬件技术研发...

4 声望
1 粉丝
0 条评论
你知道吗?

API服务是快递100自主研发的企业级服务,提供各行业快递物流管理解决方案。基于专业的软、硬件技术研发...

4 声望
1 粉丝
宣传栏