# 查询充值订单列表

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

按创建时间从新到旧分页查询账户的充值订单。

```text
GET https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/recharge-orders
```

## 调用前准备

1. 准备计费账户所属用户的有效[个人访问令牌](../../../../../guides/genesis/api-keys.md#创建和管理个人访问令牌)。
2. 调用[查询当前账户](../accounts/current.md)接口，获取目标账户的 ID。

## 请求示例

将示例中的 `$MOI_PERSONAL_ACCESS_TOKEN` 和 `$ACCOUNT_ID` 分别替换为个人访问令牌和所选账户的 ID。

```bash
curl -X GET \
  "https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/recharge-orders?page_size=2" \
  -H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
```

## 路径参数

::::{div} mo-api-parameter-table

| 参数 | 类型 | 是否必填 | 说明 |
| --- | --- | --- | --- |
| `accountID` | string | 是 | 目标账户的 ID，取自“查询当前账户”响应中的 `items[].billing_account_id`。 |

::::

## 查询参数

::::{div} mo-api-parameter-table

| 参数 | 类型 | 是否必填 | 说明 |
| --- | --- | --- | --- |
| `page_size` | integer | 否 | 每页数量，1–100；省略、非正数或大于 100 时使用 50。 |
| `page_token` | string | 否 | 下一页标记。首次请求省略；后续使用响应的 `next_page_token`。 |

::::

## 成功响应

请求成功时返回 HTTP `200` 和账户的充值订单列表；尚无订单时，列表为空。

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```json
{
  "items": [],
  "total": 0,
  "next_page_token": ""
}
```

:::::
:::::{tab-item} 字段说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `items` | array of object | 本次返回的记录。 |
| `items[].payment_order_id` | string | 支付订单 ID。 |
| `items[].order_no` | string | 充值订单号。 |
| `items[].billing_account_id` | string | Billing 账户 ID。 |
| `items[].recharge_type` | string | 充值类型。 |
| `items[].channel` | string | 支付渠道。 |
| `items[].pay_amount` | string | 支付金额，以十进制字符串返回。 |
| `items[].pay_currency` | string | 支付币种。 |
| `items[].base_credit` | string | 基础 Credit。 |
| `items[].bonus_credit` | string | 赠送 Credit。 |
| `items[].total_credit` | string | 合计 Credit。 |
| `items[].exchange_rate` | string | 订单创建时的 Credit 兑换比例。 |
| `items[].tier_snapshot` | string | 充值档位快照，JSON 字符串；可能省略。 |
| `items[].status` | string | 订单状态。 |
| `items[].refund_status` | string | 退款状态。 |
| `items[].dispute_status` | string | 支付争议状态。 |
| `items[].provider_trade_no` | string | 支付渠道交易号，可能省略。 |
| `items[].expires_at` | integer | 订单过期时间，Unix 秒。 |
| `items[].created_at` | integer | 创建时间，Unix 秒。 |
| `items[].updated_at` | integer | 更新时间，Unix 秒。 |
| `total` | integer | 符合筛选条件的总记录数。 |
| `next_page_token` | string | 下一页标记；空字符串表示没有下一页。 |

字段路径中的 `[]` 表示数组中的每一项。例如，`items[].payment_order_id` 表示数组中每一项的对应字段。

:::::
::::::
:::::::

继续查询时，将响应中的 `next_page_token` 保存为 `$NEXT_PAGE_TOKEN`，保持筛选条件不变。标记为空时停止翻页。

```bash
curl -X GET \
  "https://billing.moi.matrixorigin.cn/api/v1/billing/accounts/$ACCOUNT_ID/recharge-orders?page_size=2&page_token=$NEXT_PAGE_TOKEN" \
  -H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN"
```

## 错误响应

缺少认证信息时返回 HTTP `401`，请提供有效的个人访问令牌。

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```json
{
  "code": "unauthenticated",
  "message": "missing bearer token",
  "error": "missing bearer token"
}
```

:::::
:::::{tab-item} 字段说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `code` | string | 错误代码。 |
| `message` | string | 错误说明。 |
| `error` | string | 兼容错误说明，与 message 内容相同。 |

:::::
::::::
:::::::
