# Introduction to Logistics Query Plugin
Logistics query plug-inIt is a business operation tool provided by WeChat. By calling the plug-in, the merchant can display the order logistics information in the Mini Program, and send a message to the user when the logistics status changes. Follow the instructions below to access and introduce in your Mini ProgramLogistics Query ModuleCan be achieved. If you encounter any problems during use, you canWeChat Open Community Post communication.
# Application for qualification and regulatory penalties
- Mini Programs that meet all of the following conditions are eligible for application:
You need to open a Mini Program of WeChat payment
2, past 30 There's a deal.
Category (internal test is not required) - Frequency limitation
- One appid Up to 10w second/day
The maximum number of calls made by a user 100 times/day
- Supervision and penalties
- Query only supportedOn the Mini Program that references the plug-inThe logistics order that produces the order.
- Support only toSubscribe to WeChat Express ServiceAnd the actual order to send a message.
If the regulation is violated, the corresponding penalties, including but not limited to reducing the frequency of calls, disable plug-in capabilities, etc.
# Introduction of plugin
Use theThird party platform interface call token authorizer_access_tokenTo call the interface.
# 1. Logistics query plug-inHow to introduce
Declare in apagejson of the Mini Program
"logisticsPlugin": {
"version": "2.1.5",
"provider": "wx9ad912bf20548d92"
}
# 2. Logistics query plug-inHow to use
Then introduce a plug-in package, such as test. js, into the js file that needs to use the plug-in api
Plugin API Name: openWaybillTracking Parameter is waybillToken: Pass theBackground interface(- :https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/trace_waybill?access_token=XXX)Returned waybill_Token (developers store, and then use this token to query logistics list) Call example:
where plugin = requirePlugin("logisticsPlugin")
Page({
data:{
waybillToken: '', //Values obtained through the background interface
},
// Here by calling the api to query WeChat express service details
searchDetail:(){
const {waybillToken} = this.data
plugin.openWaybillTracking({
waybillToken: waybillToken
})
}
})
# Background API Interface Dxplaination
QuotedLogistics inquiryPlug-in businesses, before they can call the background API。
# 1. Interface authentication
WeChat API interface default use access_Token for interface authentication. So you need to add the parameter access after all the API interface addresses_token。 For example: The original call address is:https://api.weixin.qq.com/cgi-bin/test/api Finally, the actual address of the call needs to add access_The token parameter, which is: https://api.weixin.qq.com/cgi-bin/test/api?access_Token = xxxxxx Of which access_For the generation and management of tokens, seeBackground Interface Call Credential Dxplaination
# 2. List of interfaces
# Waybill interface trace_waybill
- Description: Merchants use this interface to provide WeChat with a transaction number corresponding to the waybill number. WeChat background will track the status of the waybill changes
- Request method: POST application/json
- Address requested:https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/trace_waybill?access_token=XXX
- Request parameters
Parameter Name | type | Required | Remarks |
---|---|---|---|
openid | string | yes | User openid |
transmitter_phone | string | no | **Sender's mobile phone number ** |
receiver_phone | string | yes | The recipient's mobile phone number, part of the capacity needs the user's phone number as the basis for checking |
waybill_id | string | yes | Waybill number |
goods_info | object | yes | Product information |
trans_id | string | yes | Transaction Order Number (WeChat payment generated by the transaction number, usually 420) |
*This update: sender_phone,receiver_phone。
Among goods_Info is as follows:
Parameter Name | type | Required | Remarks |
---|---|---|---|
detail_list | array | yes | Product information |
Among goods_info.detail_Each item on the list reads as follows:
Parameter Name | type | Required | Remarks |
---|---|---|---|
goods_name | string | yes | Product Name |
goods_img_url | string | yes | Product Image URL |
- Return parameters
Parameter Name | type | Required | Remarks |
---|---|---|---|
Errcode | number | yes | Return code |
errmsg | string | yes | Error message |
waybill_token | string | yes | Query id |
- Example Request parameters
{
"openid":"ovtZW4yB7DIj3CxOb6ii-nk4HhFo",
"waybill_id":"WXTESTEXPRESS0000014",
"transmitter_phone":"12345678901" ,
"receiver_phone":"123456566" ,
"goods_info":{
"detail_list":[
{
"goods_Name ":" test name, "
"goods_img_url":"www.qq.com"
},
{
"goods_Name ":" Test Name 2, "
"goods_img_url":"www.qq.com"
}
]
}
}
Return parameters
{
"errcode": 0,
"errmsg": "ok",
"waybill_token": "the_ARWHaxIxzWHmdui-AIw9KBr8qNnbmc08V0KhDyXE-IMLo6AcOqJkPsNLcLzfTb"
}
# Query waybill interface query_trace
- Description: the merchant calls in the end trace_Waybill interface, you can use this interface to query the details of the corresponding waybill
- Request method: POST application/json
- Address requested:https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/query_trace?access_token=XXX
- Request parameters
Parameter Name | type | Required | Remarks |
---|---|---|---|
waybill_token | string | yes | Query id |
- Return parameters
Parameter Name | type | Required | Remarks |
---|---|---|---|
Errcode | number | yes | Return code |
errmsg | string | yes | Error message |
waybill_info | object | yes | Waybill information |
shop_info | object | no | Product information |
delivery_info | object | no | Capacity information |
Which waybill_The info is as follows:
Parameter Name | type | Required | Remarks |
---|---|---|---|
status | number | yes | Waybill status, seeWaybill Status |
waybill_id | string | yes | Waybill number |
Which shop_Info is as follows:
Parameter Name | type | Required | Remarks |
---|---|---|---|
goods_info | object | no | Product information |
Which shop_info.goods_Info is as follows:
Parameter Name | type | Required | Remarks |
---|---|---|---|
detail_list | array | yes | Product details |
Which shop_info.goods_info.detail_Each entry in the list is as follows
Parameter Name | type | Required | Remarks |
---|---|---|---|
goods_name | string | yes | Product Name |
goods_img_url | string | yes | Product Image URL |
Of which delivery_Info is as follows:
Parameter Name | type | Required | Remarks |
---|---|---|---|
delivery_id | string | yes | Transport Company id |
delivery_name | string | no | Name of Transport Company |
- Example Request parameters
{
"waybill_token":"o_ARWHaxIxzWHmdui-AIw8SuE1QtaUZK8aUnZguAn1nsZ72ZjWlq8btV8j-wAc94",
"openid":"ovtZW4yB7DIj3CxOb6ii-nk4HhFo"
}
Return parameters
{
"errcode": 0,
"errmsg": "ok",
"waybill_info": {
"status": 0,
"waybill_id": "WXTESTEXPRESS0000014"
},
" shop_info": {
"goods_info": {
"detail_list": [
{
"goods_name": "Test name,"
"goods_img_url": "www.qq.com"
},
{
"goods_name": "Test Name 2,"
"goods_img_url": "www.qq.com"
}
]
}
}
}
# Update logistics information interface update_waybill_goods
- Description: Update item information
- Request method: POST application/json
- Address requested:https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/update_waybill_goods?access_token=XXX
- Request parameters
Parameter Name | type | Required | Remarks |
---|---|---|---|
waybill_token | string | yes | Query id |
goods_info | object | yes | Product information |
Among goods_Info is as follows:
Parameter Name | type | Required | Remarks |
---|---|---|---|
detail_list | array | yes | Product information |
Among goods_info.detail_Each item on the list reads as follows:
Parameter Name | type | Required | Remarks |
---|---|---|---|
goods_name | string | yes | Product Name |
goods_img_url | string | yes | Product Image URL |
- Return parameters
Parameter Name | type | Required | Remarks |
---|---|---|---|
Errcode | number | yes | Return code |
errmsg | string | yes | Error message |
- Example Request parameters
{
"waybill_token":"o_ARWHaxIxzWHmdui-AIw8SuE1QtaUZK8aUnZguAn1nsZ72ZjWlq8btV8j-wAc94",
"openid":"ovtZW4yB7DIj3CxOb6ii-nk4HhFo",
"goods_info":{
"detail_list":[
{
"goods_Name ":" test update product " ,
"goods_img_url":"www.qq.com"
}
]
}
}
Return parameters
{
"errcode": 0,
"errmsg": "ok"
}
# 3. Interface error code
Error code | Interpretation |
---|---|
-1 | System error |
9300560 | Maximum number of modifications reached |
40003 | Error in openid parameter |
9300534 | access_Token and openid parameters do not match |
9300513 | Maximum number of calls |
9300507 | waybill_Token parameter error |
9300559 | The waybill does not exist |
# 4. Waybill Status
Waybill Status | Interpretation |
---|---|
0 | Waybill does not exist or is not collected |
1 | Items solicited |
2 | In transport |
3 | In dispatch |
4 | Signed |
5 | abnormal |
6 | Signature on behalf of |