> ## 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.

# 使用 Stripe、微信支付或支付宝为钱包充值

> 在国际站或中国站发起钱包充值，完成支付流程，并确认款项已入账到你的咏唱引擎钱包。

咏唱引擎钱包为预付费模式。要增加余额，你需要用站点支持的提供方发起一笔支付订单并完成流程。提供方通过 webhook 确认付款后，后端会为钱包入账。

<Steps>
  <Step title="查看已启用的提供方">
    ```bash theme={null}
    curl https://ariacompute.cn/api/payments/providers
    ```

    ```json theme={null}
    {
      "providers": [
        { "name": "wechat", "enabled": true, "currency": "CNY", "region": "cn" }
      ]
    }
    ```

    在中国站你会看到 `wechat` 与 `alipay`，而非 `stripe`。
  </Step>

  <Step title="发起支付">
    使用会话 Bearer 令牌调用 `POST /api/billing/payments`。

    <CodeGroup>
      ```bash Stripe（美元） theme={null}
      curl -X POST https://ariacompute.com/api/billing/payments \
        -H "Authorization: Bearer eyJhbGciOi..." \
        -H "Content-Type: application/json" \
        -d '{"provider": "stripe", "amount": 20, "currency": "USD"}'
      ```

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

      ```bash 支付宝（人民币） theme={null}
      curl -X POST https://ariacompute.cn/api/billing/payments \
        -H "Authorization: Bearer eyJhbGciOi..." \
        -H "Content-Type: application/json" \
        -d '{"provider": "alipay", "amount": 100, "currency": "CNY"}'
      ```
    </CodeGroup>

    Stripe 返回 `redirect_url`（结账页）。微信支付与支付宝返回一个 `qr_code_url`，你需将其渲染为二维码供付款人扫码。

    ```json theme={null}
    {
      "id": "pay_01H...",
      "provider": "stripe",
      "status": "pending",
      "redirect_url": "https://checkout.stripe.com/...",
      "expires_at": "2026-09-23T11:00:00Z"
    }
    ```
  </Step>

  <Step title="完成支付">
    * **Stripe**：打开 `redirect_url` 并用银行卡付款。
    * **微信支付 / 支付宝**：用手机上对应的 App 扫描二维码。
  </Step>

  <Step title="等待确认">
    提供方调用 `POST /api/payments/webhook/{provider}`，后端为你的钱包入账。轮询 `GET /api/billing/payments/{id}` 直到 `status` 变为 `paid`。

    ```bash theme={null}
    curl -H "Authorization: Bearer eyJhbGciOi..." \
      https://ariacompute.cn/api/billing/payments/pay_01H...
    ```
  </Step>

  <Step title="确认钱包余额">
    ```bash theme={null}
    curl -H "Authorization: Bearer eyJhbGciOi..." \
      https://ariacompute.cn/api/billing/wallet
    ```

    ```json theme={null}
    { "balance": 100.00, "currency": "CNY", "updated_at": "2026-09-23T10:03:12Z" }
    ```
  </Step>
</Steps>

<Note>
  币种由站点域名固定：`.com` 为美元，`.cn` 为人民币。你无法用人民币为 `.com` 钱包充值，反之亦然。
</Note>

## 下一步

* [下载付款的发票或收据](/guides/invoices-receipts)。
* 使用 [`GET /api/billing/usage`](/api-reference/billing/usage) 查看用量。
