> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ariacompute.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /api/billing/payments — 发起钱包充值

> 使用 Stripe、微信支付或支付宝发起一笔钱包充值订单。返回供付款人完成支付的重定向 URL 或二维码。

使用受支持的提供方发起一笔钱包充值订单。响应包含一个重定向 URL（Stripe Checkout）或一个二维码 URL（微信支付、支付宝），供付款人完成支付。

**方法：** `POST` **路径：** `/api/billing/payments` **认证：** 会话 Bearer

## 请求

<ParamField body="provider" type="string" required>
  `stripe`（国际站，美元）、`wechat`（中国站，人民币）或 `alipay`（中国站，人民币）。必须已启用：请先检查 `GET /api/payments/providers`。
</ParamField>

<ParamField body="amount" type="number" required>
  以 `currency` 主单位计价的充值金额（例如 `100` 表示 100 元）。
</ParamField>

<ParamField body="currency" type="string" required>
  国际站为 `USD`，中国站为 `CNY`。
</ParamField>

## 响应

<ResponseField name="id" type="string">
  支付标识。
</ResponseField>

<ResponseField name="provider" type="string">
  所选提供方。
</ResponseField>

<ResponseField name="status" type="string">
  初始状态，通常为 `pending`。
</ResponseField>

<ResponseField name="redirect_url" type="string">
  Stripe Checkout URL（仅 Stripe）。
</ResponseField>

<ResponseField name="qr_code_url" type="string">
  供微信支付或支付宝渲染的二维码 URL。
</ResponseField>

<ResponseField name="expires_at" type="string">
  ISO 8601 过期时间戳。
</ResponseField>

## 示例

```bash theme={null}
curl -X POST https://ariacompute.cn/api/billing/payments \
  -H "Authorization: Bearer eyJhbGciOi..." \
  -H "Content-Type: application/json" \
  -d '{"provider": "wechat", "amount": 100, "currency": "CNY"}'
```

```json theme={null}
{
  "id": "pay_01H...",
  "provider": "wechat",
  "status": "pending",
  "qr_code_url": "https://pay.weixin.qq.com/...",
  "expires_at": "2026-09-23T11:00:00Z"
}
```

## 错误

| 状态    | 含义                   |
| ----- | -------------------- |
| `400` | 缺失字段或不支持的提供方 / 币种组合。 |
| `401` | 缺失或无效的会话令牌。          |
| `409` | 提供方未启用。              |
