本部署未开启买入。调用返回 40302,不能创建订单,不扣库存。
POST/api/v1/orders
| 认证 | 请求头 Authorization: Bearer <访问令牌>,访问令牌用设备码换取,不要向用户要密码、短信验证码或 API Key |
|---|---|
| 权限 | order:write 在本部署未开启买入时返回 40302,不能创建订单,不扣库存。 |
请求体
application/json
只能有一行,不要传 price。variant_id 和 product_id 至少填一个
client_order_nostring必填幂等业务单号,重复提交返回原订单,不切换渠道
payment_channelenum<string>收银台,省略时是 desktop
可选值: desktopmobile
itemsobject[]必填只能有一项
items[].variant_idstring规格 ID。与 product_id 至少填一个
items[].product_idstring商品 ID。只有一条可售规格时才可传商品 ID
items[].qtyinteger必填数量
请求示例
{
"client_order_no": "agent-20260516-001",
"payment_channel": "desktop",
"items": [
{
"variant_id": "var_example",
"product_id": "prd_example",
"qty": 1
}
]
}响应
201
application/json
创建成功时 HTTP 201,body 的 code 仍是 200,资源在 data
idstring必填订单 ID
statusenum<string>必填只有 paid 表示支付成功
可选值: pendingpaidclosed
amountinteger必填订单金额,整数分
currencystring必填货币代码
updated_atstring必填更新时间,ISO-8601
items[].idstring必填订单行 ID
items[].variant_idstring必填下单时的规格 ID
items[].qtyinteger必填数量
items[].amountinteger必填行金额,整数分
payment.idstring支付记录 ID,没有支付记录时 payment 为 null
payment.providerstring支付实现,由服务端固定
payment.channelenum<string>已保存的收银台
可选值: desktopmobile
payment.statusstring支付记录状态
payment.actionstring | null完整支付 URL,打开它不等于已支付
unapplied_receipt.statusenum<string>未履约收款状态,没有时为 null
可选值: openfulfilled_manuallyrefundedrefund_failed
unapplied_receipt.amountinteger收款金额,整数分
unapplied_receipt.provider_trade_nostring服务商交易号
unapplied_receipt.failure_reasonstring | null失败原因,没有时为 null
响应示例
{
"id": "id_example",
"status": "pending",
"amount": 159900,
"currency": "CNY",
"updated_at": "2026-05-16T00:00:00.000Z",
"items": [
{
"id": "id_example",
"variant_id": "var_example",
"qty": 1,
"amount": 159900
}
],
"payment": {
"id": "pay_example",
"provider": "string",
"channel": "desktop",
"status": "pay_example",
"action": null
},
"unapplied_receipt": {
"status": "open",
"amount": 159900,
"provider_trade_no": "string",
"failure_reason": null
}
}