# logistics.getOrder

Call this API at the server side. For more information, see Server API.

This API supports Cloud Calls. The WeChat DevTools version must be 1.02.1904090 or later (download the latest stable version here), and the wx-server-sdk version must be 0.4.0 or later.

Obtains waybill data.

Calling methods:

# HTTPS Call

# Request Address

POST https://api.weixin.qq.com/cgi-bin/express/business/order/get?access_token=ACCESS_TOKEN

# Request Parameters

Attribute Type Default Required Description
access_token string Yes Credentials to call API
order_id string Yes The ID of the order. It must be globally unique.
openid string Yes The OpenID of the user.
delivery_id string Yes The ID of the express company. See getAllDelivery.
waybill_id string Yes The ID of the waybill.

# Return Value

# Object

Property Type Description
print_html string The Base64 encoding result of the waybill HTML
waybill_data Array.<Object> The waybill information

waybill_data is composed as follows

Property Type Description
key string The key of the waybill information.
value string The value of the waybill information.

# Request Data Example

{
  "order_id": "01234567890123456789",
  "openid": "oABC123456",
  "delivery_id": "SF",
  "waybill_id": "123456789"
}

# Return Data Example

{
  "print_html": "jh7DjipP4ul4CQYUh69cniskrQZuOPwa1inAbXIqKbU0t71c0s65Au54cdWBZW0QJY4LYeofdM",
  "waybill_data": [
    {
      "key": "SF_bagAddr",
      "value": "Guangzhou"
    },
    {
      "key": "SF_mark",
      "value": "101- 07-03 509"
    }
  ]
}

# Cloud Call

Cloud call is a capability provided by Mini Program·Cloud Base that allows you to call WeChat APIs in a cloud function. It must be used via wx-server-sdk in the cloud function.

# API Calling Method

openapi.logistics.getOrder

You need to configure the permissions for the logistics.getOrder API via config.json. Details

# Request Parameters

Attribute Type Default Required Description
orderId string Yes The ID of the order. It must be globally unique.
openid string Yes The OpenID of the user.
deliveryId string Yes The ID of the express company. See getAllDelivery.
waybillId string Yes The ID of the waybill.

# Return Value

# Object

Property Type Description
printHtml string The Base64 encoding result of the waybill HTML
waybillData Array.<Object> The waybill information

waybillData is composed as follows

Property Type Description
key string The key of the waybill information.
value string The value of the waybill information.

# Request Data Example

const cloud = require('wx-server-sdk')
  cloud.init()
  exports.main = async (event, context) => {
    try {
      const result = await cloud.openapi.logistics.getOrder({
        openid: 'oABC123456',
        orderId: '01234567890123456789',
        deliveryId: 'SF',
        waybillId: '123456789'
      })
      console.log(result)
      return result
    } catch (err) {
      console.log(err)
      return err
    }
  }

# Return Data Example

{
  "printHtml": "jh7DjipP4ul4CQYUh69cniskrQZuOPwa1inAbXIqKbU0t71c0s65Au54cdWBZW0QJY4LYeofdM",
  "waybillData": [
    {
      "key": "SF_bagAddr",
      "value": "Guangzhou"
    },
    {
      "key": "SF_mark",
      "value": "101- 07-03 509"
    }
  ],
  "errMsg": "openapi.logistics.getOrder:ok"
}