Cancel order (req_cancel)
About 411 words
v1 draft
This page is part of the draft v1 integration contract; details may change along with the integration checklist, so rely on the official checklist published in the portal.
Requests cancellation of an order that has not yet been fulfilled. Cancellation is confirmed asynchronously; the final result comes from an order query or a callback.
- Permission:
cancel.write - Method:
POST - Idempotency: keyed by order number; repeated submissions return the same result
- Preconditions: the order is unfulfilled and not final
点开字段可查看类型与说明
正在加载交互式结构…
Request example
Endpoint: POST /dist/api/v1/req_cancel
{
"id": "shop-a-20261124-cxl-001",
"cmd": "req_cancel",
"data": {
"order_no": "XS20261124000123",
"reason": "消费者取消购买"
},
"stamp": 1795000000
}{
"id": "shop-a-20261124-cxl-001",
"cmd": "req_cancel",
"code": 0,
"msg": "",
"data": {
"order_id": 9001,
"order_no": "XS20261124000123",
"cancel_state": "requested",
"requested_at": "2026-11-24T13:06:10Z"
},
"stamp": 1795000001
}cancel_state | Meaning | Next step |
|---|---|---|
requested | Accepted, in progress | Wait for a callback or query the order |
done | Cancelled | The hold has been released |
rejected | Cannot be cancelled | See reason_code |
On rejected, code is non-0, commonly 2006 (fulfilled, cannot be cancelled) or 2007 (order is final).
Rules
- Unfulfilled: cancellation can be requested. Once it is confirmed, the hold is released — this is a release, not a refund.
- Fulfilled: cancellation is not possible. For quality issues, use after-sales.
- In progress: cancellation is a request, not a guarantee of immediate success. If fulfillment completes before the cancellation is confirmed, the order is still fulfilled and the cancellation returns
NOT_CANCELABLE. - A cancelled order cannot be revived. To buy again, place a new order with a new
req_idand link it to the original order yourself.
Cancellation vs. refund
| Action | Trigger | Fund effect |
|---|---|---|
| Cancellation | Not fulfilled | The hold is released and available balance returns |
| Refund | Fulfilled and approved via after-sales | The approved amount is returned to the balance and a refund transaction is recorded |
Do not use cancellation to simulate a refund, and do not repeatedly submit cancellations against an order that has already been charged.
Errors
| code | Scenario | Action |
|---|---|---|
2006 | Fulfilled, cannot be cancelled | Use after-sales |
2007 | Order is final | Do not repeat the operation |
2008 | Order does not exist or does not belong to this shop | Check the order number and the shop |
1003 | cancel.write not enabled | Enable the permission in the portal |
3002 | Repeated cancellation of the same order with a conflicting state | Query the order to confirm its current state first |