模块概述
订单模块用于查询订单与通过 API 创建待付款订单,对应权限范围 order.list、order.detail、order.create。
订单列表查询
| 项目 | 内容 |
| URL | https://www.dapengcloud.com/api.php/v1/order/list |
| 权限范围 | order.list |
| 请求方式 | GET(也接受 POST) |
| 功能说明 | 按创建时间倒序分页返回当前客户的订单 |
请求参数
| 参数 | 类型 | 必填 | 说明 |
| page | int | 否 | 页码,默认 1。 |
| per_page | int | 否 | 每页条数,默认 20,最大 50。 |
响应参数(data)
| 字段 | 类型 | 说明 |
| list | array | 订单列表。 |
| list[].id | int | 订单 ID。 |
| list[].order_number | string | 订单编号,全局唯一。 |
| list[].status | string | 订单状态,取值见下表。 |
| list[].total | string | 订单总额,如 "59.00"。 |
| list[].currency | string | 币种,固定为 CNY。 |
| list[].created_at | string | 下单时间。 |
| page | int | 当前页码。 |
| per_page | int | 当前每页条数。 |
订单状态枚举
| status | 含义 | 说明 |
| pending | 待付款 | 订单已创建,尚未完成支付。 |
| paid | 已付款 | 支付成功,等待或正在开通服务。 |
| activated | 已开通 | 服务已开通完成。 |
| cancelled | 已取消 | 订单已取消。 |
| refunded | 已退款 | 订单已退款。 |
| provision_failed | 开通失败 | 支付成功但上游开通失败,需人工或自动重试处理。 |
请求示例
GET /api.php/v1/order/list?page=1&per_page=10 HTTP/1.1
Host: www.dapengcloud.com
X-Access-Key: AKID8F2C4A91B7D34E6F0A1C2B3D
X-Timestamp: 1761000000
X-Signature: 0c6a9e2f4b8d1a3c5e7f9012b4d6f8a0c2e4b6d8f0a2c4e6b8d0f2a4c6e8b0d2f
成功响应示例
{
"code": 0,
"message": "ok",
"data": {
"list": [
{
"id": 8,
"order_number": "ORD202610210001",
"status": "pending",
"total": "59.00",
"currency": "CNY",
"created_at": "2026-10-21 10:12:33"
}
],
"page": 1,
"per_page": 10
}
}
失败响应示例
{
"code": 401,
"message": "签名验证失败",
"data": null,
"error": { "code": "auth_failed" }
}
订单详情查询
| 项目 | 内容 |
| URL | https://www.dapengcloud.com/api.php/v1/order/detail |
| 权限范围 | order.detail |
| 请求方式 | GET(也接受 POST) |
| 功能说明 | 返回订单主体信息及全部订单明细,仅可查询本人订单 |
请求参数
| 参数 | 类型 | 必填 | 说明 |
| id | int | 是 | 订单 ID,必须大于 0,且属于当前密钥所属客户。 |
响应参数(data)
| 字段 | 类型 | 说明 |
| order | object | 订单主体,字段见下。 |
| order.id | int | 订单 ID。 |
| order.order_number | string | 订单编号。 |
| order.parent_order_id | int / null | 续费订单指向的源订单 ID;普通订单为 null。 |
| order.client_id | int | 客户 ID。 |
| order.status | string | 订单状态,取值见订单状态枚举。 |
| order.total | string | 订单总额。 |
| order.currency | string | 币种。 |
| order.notes | string / null | 订单备注。 |
| order.ip | string / null | 下单来源 IP。 |
| order.created_at | string | 下单时间。 |
| order.updated_at | string | 最后更新时间。 |
| items | array | 订单明细列表。 |
| items[].id | int | 明细 ID。 |
| items[].order_id | int | 所属订单 ID。 |
| items[].product_id | int | 产品 ID。 |
| items[].product_name | string | 下单时的产品名称快照。 |
| items[].cycle | string | 计费周期,如 month、quarter、semiannual、annual。 |
| items[].unit_price | string | 单价。 |
| items[].quantity | int | 数量。 |
| items[].amount | string | 明细金额。 |
| items[].config_snapshot | string / null | 下单时的配置快照(JSON 字符串),无配置时为 null。 |
请求示例
GET /api.php/v1/order/detail?id=8 HTTP/1.1
Host: www.dapengcloud.com
X-Access-Key: AKID8F2C4A91B7D34E6F0A1C2B3D
X-Timestamp: 1761000000
X-Signature: 1f3a5c7e9b2d4f6081a3c5e7f9b2d4f6081a3c5e7f9b2d4f6081a3c5e7f9b2d
成功响应示例
{
"code": 0,
"message": "ok",
"data": {
"order": {
"id": 8,
"order_number": "ORD202610210001",
"parent_order_id": null,
"client_id": 1001,
"status": "pending",
"total": "59.00",
"currency": "CNY",
"notes": "API 下单",
"ip": "203.0.113.10",
"created_at": "2026-10-21 10:12:33",
"updated_at": "2026-10-21 10:12:33"
},
"items": [
{
"id": 15,
"order_id": 8,
"product_id": 3,
"product_name": "标准型 VPS",
"cycle": "month",
"unit_price": "59.00",
"quantity": 1,
"amount": "59.00",
"config_snapshot": null
}
]
}
}
失败响应示例
{
"code": 500,
"message": "order not found",
"data": null,
"error": { "code": "controller_error" }
}
订单不存在、不属于当前客户或 id 缺失时,服务端以 500 controller_error 返回具体原因(见错误码对照表说明)。
API 快速下单
| 项目 | 内容 |
| URL | https://www.dapengcloud.com/api.php/v1/order/create |
| 权限范围 | order.create |
| 请求方式 | POST |
| 功能说明 | 按产品与计费周期创建一笔待付款订单,返回订单 ID 与总额 |
请求参数(JSON Body)
| 参数 | 类型 | 必填 | 说明 |
| product_id | int | 是 | 产品 ID,必须为在售产品(后台状态为启用)。 |
| cycle | string | 否 | 计费周期,默认 month。必须是该产品已配置价格的周期,常用值:month 月付、quarter 季付、semiannual 半年付、annual 年付。 |
响应参数(data)
| 字段 | 类型 | 说明 |
| order_id | int | 新建订单的 ID,可用于后续详情查询或在会员中心继续支付。 |
| total | number | 订单总额(数值类型)。 |
| currency | string | 币种,固定为 CNY。 |
业务说明
- 服务端会重新读取产品价格,不信任请求中传入的任何金额,避免价格篡改。
- 创建的订单状态为 pending(待付款),同时生成一条订单明细;不会自动扣款、不会自动开通。
- 下单成功会触发系统订单事件,客户将收到对应的站内通知(如已配置)。
- 该接口不具备幂等性:重复调用会创建多笔订单。请勿在超时后盲目重试,应先通过 order/list 核实是否已创建。
请求示例
POST /api.php/v1/order/create HTTP/1.1
Host: www.dapengcloud.com
Content-Type: application/json; charset=utf-8
X-Access-Key: AKID8F2C4A91B7D34E6F0A1C2B3D
X-Timestamp: 1761000000
X-Signature: 7b1d3f5a9c2e4b6d8f0a2c4e6b8d0f2a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d
{"product_id":3,"cycle":"month"}
成功响应示例
{
"code": 0,
"message": "ok",
"data": {
"order_id": 8,
"total": 59,
"currency": "CNY"
}
}
失败响应示例
{
"code": 500,
"message": "product not available",
"data": null,
"error": { "code": "controller_error" }
}
产品不存在、已下架,或指定周期未配置价格时返回该错误;product_id 缺失时 message 为 product_id required。