Java express mailing / billing API, one-time access to SF, Zhongtong, Yuantong, Shentong, Yunda, Jingdong, Debang, Baishi, Tiantian

Time:2021-11-27

In order to enable you to access Shunfeng, Zhongtong, Yuantong, Shentong, Yunda, Jingdong, Debang, Baishi, Tiantian and other mainstream express companies faster, you can copy the source code to your project, change the parameters in the source code into your own account parameters, and you can use it directly.

This Java demo is convenient for developers to realize: the operation front end only needs one account to select multiple express companies according to customer needs or express capacity, and make an appointment for the express company to pick up the parts on-site (discount price method)

Express delivery API description

Merchant mail service is a set of solutions specially provided for mail enterprises. Through the interface, it can meet the needs of regular mail users such as enterprises, e-commerce, wechat merchants, express outlets and collection points for door-to-door collection by express companies after placing orders.

If you need a personal reservation mailing service, please connect to the C-end mailing interface:https://cloud.kuaidi100.com/marketDetail?id=32164354057The interface is free, and the express fee is settled by the sender and the courier.

Description of merchant mailing API support express company

Supported express companies:

1. Merchant mail (preferred express) supports the mail orders of express companies such as Zhongtong, Yuantong, Baishi, Tiantian, Yunda, Jitu and zhaijishou.

2. Merchants send mail (official express) to support deppon, JD, Yuantong and Shentong.

Difference between capacity and freight:

1. Preferred express: the capacity of the mailing address is not guaranteed. The supported express companies will change according to different mailing addresses; Ladder freight price, please check the shipping capacity and shipping price before docking:https://api.kuaidi100.com/product/expressprice/

2. Official express: it can guarantee the transportation capacity of the national address. The freight is the discount price of the official delivery price. For the specific freight price, please consult the online customer service or scan the code on the right to consult the customer manager.

Example code of merchant mail query capacity:

/**
     *Merchant mail inquiry capacity
     */
     
    @Test
    public void testBorderQuery() throws Exception {
        BOrderQueryReq bOrderQueryReq = new BOrderQueryReq();
        Borderqueryreq.setsendaddr ("Huaqiang south, Futian District");

        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));
    }

Merchant mailExample code:

/**
     *Merchant mail
     */
  
    @Test
    public void testBorder() throws Exception {
        PrintReq printReq = new PrintReq();
        BOrderReq bOrderReq = new BOrderReq();
        bOrderReq.setKuaidicom(CompanyConstant.ZT);
        Borderreq.setsendmanname ("Zhang San");
        bOrderReq.setSendManMobile("15966666666");
        Borderreq. Setsendmanprintaddr ("Huaqiang south, Futian District, Shenzhen, Guangdong");
        Borderreq.setrecmaname ("Li Si");
        bOrderReq.setRecManMobile("15966666666");
        Borderreq. Setrecmanprintaddr ("Kingdee Software Park, Nanshan District, Shenzhen, Guangdong");
        bOrderReq.setCallBackUrl("https://www.baidu.com");
        Borderreq.setcargo ("file");
        Borderreq. Setremark ("test order, cancel later");
        bOrderReq.setWeight("1");
        bOrderReq.setSalt("123456");
        Borderreq. Setservicetype ("standard express");

        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));
    }

Merchant sends mail to obtain verification codeExample code:

/**
     *Merchant sends mail to obtain verification code
     */
      
    @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));
    }

Cancel merchant mail orderExample code:

/**
     *Cancel merchant mail order
     */
     
    @Test
    public void testBorderCancel() throws Exception {
        PrintReq printReq = new PrintReq();
        BOrderCancelReq bOrderCancelReq = new BOrderCancelReq();
        bOrderCancelReq.setTaskId("4D07550D8E685E06B3C679632E68ACDD");
        bOrderCancelReq.setOrderId("100012022010566");
        Bordercancelreq.setcancelmsg ("test order cancellation");

        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-end query capacityExample code:

/**
     *C-end query capacity
     */
     
    @Test
    public void testCOrderQuery() throws Exception {
        COrderQueryReq cOrderQueryReq = new COrderQueryReq();
        Ctorderqueryreq.setaddress ("Huaqiang south, Nanshan District, Shenzhen City, Guangdong Province");
        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-end mailExample code:

/**
     *C-end mail
     */

    @Test
    public void testCOrder() throws Exception {
        COrderReq cOrderReq = new COrderReq();
        cOrderReq.setCom(CompanyConstant.JD);
        Ctorderreq.setsendmaname ("Zhang San");
        cOrderReq.setSendManMobile("15966666666");
        Ctorderreq.setsendmanprintaddr ("Kingdee Software Park, Nanshan District, Shenzhen, Guangdong");
        Ctorderreq.setrecmaname ("Li Si");
        cOrderReq.setRecManMobile("15966666666");
        Ctorderreq.setrecmanprintaddr ("Huaqiang south, Futian District, Shenzhen, Guangdong");
        cOrderReq.setCallBackUrl("https://www.baidu.com");
        Ctorderreq.setcargo ("file");
        Ctorderreq.setremark ("test order, cancel later");
        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));
    }

Cancel the c-mail commandExample code:

/**
     *C-end cancellation
     */

    @Test
    public void testCOrderCancel() throws Exception {
        COrderCancelReq cOrderCancelReq = new COrderCancelReq();
        cOrderCancelReq.setTaskId("B19BB4C6F33BE9E735A63D4142557751");
        cOrderCancelReq.setOrderId("11115207");
        Ctordercancelreq.setcancelmsg ("test sheet");
        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));
    }
}

Official technical support:https://api.kuaidi100.com/document/5eb9f5b686b0df41883139f4.html