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

# GET /api/billing/invoices/{paymentId}/download — 下载发票

> 下载已支付中国站付款的电子发票（电子发票）。接受会话 Bearer 或 ?token=，以便普通浏览器链接直接生效。

下载已支付中国站付款的电子发票（电子发票）。接受通过 `Authorization: Bearer` 或查询字符串 `?token=` 传递的会话 JWT，因此浏览器中普通的 `<a href>` 链接无需设置 Header 即可生效。

**方法：** `GET` **路径：** `/api/billing/invoices/{paymentId}/download` **认证：** 会话 Bearer 或 `?token=` 查询 JWT

## 路径参数

<ParamField path="paymentId" type="string" required>
  已支付且关联发票的支付标识。
</ParamField>

## 查询参数

<ParamField query="token" type="string">
  用于浏览器发起下载的会话 JWT。
</ParamField>

## 响应

`200 OK`，以 PDF 或 HTML 流返回发票，并带 `Content-Disposition: attachment; filename=...` 头。

## 示例

```bash theme={null}
# 服务端使用 Header 认证
curl -L -H "Authorization: Bearer eyJhbGciOi..." \
  https://ariacompute.cn/api/billing/invoices/pay_01H.../download \
  -o invoice.pdf

# 浏览器友好，使用查询令牌
curl -L "https://ariacompute.cn/api/billing/invoices/pay_01H.../download?token=eyJhbGciOi..." \
  -o invoice.pdf
```

## 错误

| 状态    | 含义           |
| ----- | ------------ |
| `401` | 缺失或无效的令牌。    |
| `404` | 未找到支付或未开具发票。 |
