# logistics.onCancelOrder

This documentation describes messages or events received on the server. For details, see Message Push.

Triggers an order cancellation event.

# Message Parameters

# Object

Property Type Description
ToUserName string The UserName of the express company's Mini Program.
FromUserName string The OpenID of the order placer.
CreateTime number The time of the event. It is a Unix timestamp.
MsgType string The type of the message. It is event.
Event string The type of the event. It is cancel_waybill.
OrderID string The ID that uniquely identifies the order. It is generated by the merchant.
BizID string The ID of the merchant.
BizPwd string The password of the merchant.
ShopAppID string The AppID of the merchant's Mini Program.
WayBillID string The ID of the waybill. It is generated based on the WeChat account segment.

# Message Responses

Property Type Default Required Description
ToUserName string Yes The FromUserName in the request is returned as it is.
FromUserName string Yes The UserName of the express company's Mini Program.
CreateTime number Yes The time of the event. It is a Unix timestamp.
MsgType string Yes The type of the message. It is event.
Event string Yes The type of the event. It is cancel_waybill and is case-insensitive.
BizID string Yes The ID of the merchant. It is returned as is.
OrderID string Yes The ID that uniquely identifies the order. It is generated by the merchant and is returned as is.
WayBillID string Yes The ID of the waybill. It is returned as is.
ResultCode number Yes The error code for the result.
ResultMsg string Yes Details about the result.

Valid values of ResultCode

Value Description Minimum Version
0 Canceled
-1 Other errors
30001 Parameter error (BizID, OrderID, or WayBillID does not exist)
30002 Picked up already. Cannot be canceled.
30003 Invalid order (It was canceled before or has exceeded the signing time). Cannot be canceled.
30004 The express company does not support order cancellation.

# Example of the Message Data Packet

In XML format

<xml>
    <ToUserName><![CDATA[gh_abcdefg]]></ToUserName>
    <FromUserName><![CDATA[oABCD]]></FromUserName>
    <CreateTime>1533042556</CreateTime>
    <MsgType><![CDATA[event]]></MsgType>
    <Event><![CDATA[cancel_waybill]]></Event>
    <BizID><![CDATA[xyz]]></BizID>
    <BizPwd><![CDATA[xyz123]]></BizPwd>
    <ShopAppID><![CDATA[wxABCD]]></ShopAppID>
    <OrderID><![CDATA[012345678901234567890123456789]]></OrderID>
    <WayBillID><![CDATA[123456789]]></WayBillID>
</xml>

In JSON format

{
  "ToUserName": "gh_abcdefg",
  "FromUserName": "oABCD",
  "CreateTime": 1533042556,
  "MsgType": "event",
  "Event": "cancel_waybill",
  "BizID": "xyz",
  "BizPwd": "xyz123",
  "ShopAppID": "wxABCD",
  "OrderID": "012345678901234567890123456789",
  "WayBillID": "123456789"
}

# Example of the Returned Data Packet

In XML format

<xml>
    <ToUserName><![CDATA[oABCD]]></ToUserName>
    <FromUserName><![CDATA[gh_abcdefg]]></FromUserName>
    <CreateTime>1533042556</CreateTime>
    <MsgType><![CDATA[event]]></MsgType>
    <Event><![CDATA[cancel_waybill]]></Event>
    <BizID><![CDATA[xyz]]></BizID>
    <OrderID><![CDATA[012345678901234567890123456789]]></OrderID>
    <WayBillID><![CDATA[123456789]]></WayBillID>
    <ResultCode>0</ResultCode>
    <ResultMsg><![CDATA[success]]></ResultMsg>
</xml>

In JSON format

{
  "ToUserName": "oABCD",
  "FromUserName": "gh_abcdefg",
  "CreateTime": 1533042556,
  "MsgType": "event",
  "Event": "cancel_waybill",
  "BizID": "xyz",
  "OrderID": "012345678901234567890123456789",
  "WayBillID": "123456789",
  "ResultCode": 0,
  "ResultMsg": "success"
}