跳到主内容
大鹏云 大鹏云 DAPENG CLOUD
首页 · 帮助中心 · API 开发文档 · API 开发者文档(六):订单模块接口

API 开发者文档(六):订单模块接口

模块概述

订单模块用于查询订单与通过 API 创建待付款订单,对应权限范围 order.list、order.detail、order.create。

订单列表查询

项目内容
URLhttps://www.dapengcloud.com/api.php/v1/order/list
权限范围order.list
请求方式GET(也接受 POST)
功能说明按创建时间倒序分页返回当前客户的订单

请求参数

参数类型必填说明
pageint否页码,默认 1。
per_pageint否每页条数,默认 20,最大 50。

响应参数(data)

字段类型说明
listarray订单列表。
list[].idint订单 ID。
list[].order_numberstring订单编号,全局唯一。
list[].statusstring订单状态,取值见下表。
list[].totalstring订单总额,如 "59.00"。
list[].currencystring币种,固定为 CNY。
list[].created_atstring下单时间。
pageint当前页码。
per_pageint当前每页条数。

订单状态枚举

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" }
}

订单详情查询

项目内容
URLhttps://www.dapengcloud.com/api.php/v1/order/detail
权限范围order.detail
请求方式GET(也接受 POST)
功能说明返回订单主体信息及全部订单明细,仅可查询本人订单

请求参数

参数类型必填说明
idint是订单 ID,必须大于 0,且属于当前密钥所属客户。

响应参数(data)

字段类型说明
orderobject订单主体,字段见下。
order.idint订单 ID。
order.order_numberstring订单编号。
order.parent_order_idint / null续费订单指向的源订单 ID;普通订单为 null。
order.client_idint客户 ID。
order.statusstring订单状态,取值见订单状态枚举。
order.totalstring订单总额。
order.currencystring币种。
order.notesstring / null订单备注。
order.ipstring / null下单来源 IP。
order.created_atstring下单时间。
order.updated_atstring最后更新时间。
itemsarray订单明细列表。
items[].idint明细 ID。
items[].order_idint所属订单 ID。
items[].product_idint产品 ID。
items[].product_namestring下单时的产品名称快照。
items[].cyclestring计费周期,如 month、quarter、semiannual、annual。
items[].unit_pricestring单价。
items[].quantityint数量。
items[].amountstring明细金额。
items[].config_snapshotstring / 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 快速下单

项目内容
URLhttps://www.dapengcloud.com/api.php/v1/order/create
权限范围order.create
请求方式POST
功能说明按产品与计费周期创建一笔待付款订单,返回订单 ID 与总额

请求参数(JSON Body)

参数类型必填说明
product_idint是产品 ID,必须为在售产品(后台状态为启用)。
cyclestring否计费周期,默认 month。必须是该产品已配置价格的周期,常用值:month 月付、quarter 季付、semiannual 半年付、annual 年付。

响应参数(data)

字段类型说明
order_idint新建订单的 ID,可用于后续详情查询或在会员中心继续支付。
totalnumber订单总额(数值类型)。
currencystring币种,固定为 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。
这篇文章对你有帮助吗?