取消代购订单 API

以下路径能力相同:

  • POST /v1/orders/cancel — body 必须传 channel
  • POST /v1/orders/1688/cancel — body 可省略 channel
  • POST /v1/orders/taobao/cancel — body 可省略 channel

可选幂等请求头

建议每次逻辑取消生成一个唯一 Idempotency-Key,只有重试同一请求时才复用。

POST /v1/orders/cancel
Authorization: Bearer <API_KEY>
Content-Type: application/json
Idempotency-Key: 2cc45e99-2424-4cc3-bb87-20c58c67170e
 
{"channel":"1688","order_id":"1234567890","cancel_reason":"buyerCancel"}
情况结果
首次请求Gateway 执行取消并保存结果
相同 key + 相同标准化参数回放原结果;响应头含 Idempotency-Replayed: true
相同 key + 不同参数HTTP 409 IDEMPOTENCY_CONFLICT
首次请求仍在执行HTTP 409 IDEMPOTENCY_REQUEST_IN_PROGRESS;等待 error.details.retry_after_ms 后用原 key 重试
之前的上游结果不确定HTTP 409 CANCEL_RESULT_UNKNOWN;先查询订单状态再处理

渠道差异

  • 1688: cancel_reason 为 buyerCancel、sellerGoodsLack、other;可选 remark
  • 淘宝: cancel_reason 为自由文案;可选 sub_order_ids 部分取消和 cancel_remark
  • 淘宝返回 pending: true 仅表示异步请求已受理,需通过订单详情 / 采购单查询确认最终状态

响应

返回 StandardOrderCancelResult,字段见 订单响应模型。

获取支持

需要集成帮助?请联系开发者支持 support@hiobuy.com · 预计 1–2 个工作日内回复

发送邮件