订单-创建
订单 - 后台创建订单
接口信息
- 接口地址:
{your-site-url}/api/skill/order/create-order
- 基础 URL:
{your-site-url} 需替换为你自己的独立站 URL 地址,如 https://your-domain.com/apimanager666
- 请求方式:
POST
- 说明: 此接口用于在后台手动创建一个新订单。
认证
请求头中需要携带 skill-access-token:
| Header |
值 |
skill-access-token |
{your-skill-access-token} (请替换为你自己的 token) |
Content-Type |
application/json |
请求参数 (JSON Body)
order - 订单信息
| 字段 |
类型 |
必填 |
说明 |
order.first_name |
string |
是 |
收货人名字 |
order.last_name |
string |
是 |
收货人姓氏 |
order.phone |
string |
是 |
收货人电话 |
order.email |
string |
是 |
收货人邮箱 |
order.country_code |
string |
是 |
国家简码,从 得到国家和省列表 获取 |
order.province_code |
string |
是 |
省/州简码 |
order.city |
string |
是 |
城市 |
order.address_1 |
string |
是 |
详细地址行 1 |
order.address_2 |
string |
是 |
详细地址行 2 |
order.zip |
string |
是 |
邮政编码 |
order.items |
Array[Object] |
是 |
订单商品列表 |
order.discount_amount |
string |
否 |
折扣金额 |
order.shipping_method_name |
string |
否 |
货运方式名称 |
order.shipping_amount |
string |
否 |
运费金额 |
order.tags |
Array[string] |
否 |
订单标签,可传入多个 |
order.note |
string |
否 |
订单备注 |
order.items - 订单商品
| 字段 |
类型 |
必填 |
说明 |
order.items[].product_id |
int |
是 |
商品 ID |
order.items[].variant_id |
int |
是 |
规格变体 ID |
order.items[].qty |
int/string |
是 |
购买数量 |
请求示例
cURL
curl --location --request POST '{your-site-url}/api/skill/order/create-order' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"order": {
"first_name": "Terry",
"last_name": "zhao",
"phone": "18600001111",
"address_1": "licunjiedao ",
"address_2": "steet 115",
"city": "qingdao",
"country_code": "CN",
"province_code": "SD",
"email": "fecify@126.com",
"zip": "266326",
"items": [
{
"product_id": 7040,
"variant_id": 48944,
"qty": 1
},
{
"product_id": 7034,
"variant_id": 48930,
"qty": "2"
}
],
"discount_amount": "11",
"shipping_method_name": "Shipping",
"shipping_amount": "33",
"tags": [
"china",
"age"
],
"note": "order remark"
}
}'
返回结果
code 为 200 表示调用成功;code 不为 200 表示调用失败。
成功响应
{
"code": 200,
"data": {
"order_id": 6422,
"order_number": "FECE602910789461667"
},
"message": "success"
}
返回字段说明
| 字段 |
类型 |
说明 |
code |
Number |
状态码,200 表示成功 |
message |
String |
执行结果的文字描述 |
data.order_id |
int |
新创建的订单 ID |
data.order_number |
string |
新创建的订单编号 |
注意事项
items 中 qty 字段支持传入 int 或 string 类型
- 折扣金额
discount_amount 为非必填项,不传则无折扣
tags 为订单标签数组,可传入多个标签值
shipping_method_name 和 shipping_amount 为非必填项,用于指定货运方式和运费
- 创建成功后通过
order_id 或 order_number 可调用 订单-详细 查看完整订单信息