获取发票详情
使用系统访问令牌读取当前账户的数据
国内用户请注意: 中国大陆用户请使用 https://toapis.cn 作为接口地址 (Base URL). 文档示例中的 https://toapis.com 请替换为 https://toapis.cn.
鉴权, 分页与错误处理见接入说明.
使用说明
仅主账号可查询自身账单. 子账号访问返回 HTTP 403, 主账号也不能借此查询成员账单.
默认近 31 天, 最长 366 天. 仅覆盖当前已验证 Customer, meta.coverage=current_customer_only, 不代表全部历史. Customer 映射改变后旧游标失效. 金额按 Stripe 原币种转换为十进制字符串: USD/CNY 为两位, JPY 为零位, KWD 为三位, ISK/UGX 按两位兼容规则处理. subtotal/total 是小计和总额, amount_due/amount_paid/amount_remaining 是应付, 已付和剩余金额. 无可靠本地订单关联时 platform_trade_no=null, number 和 paid_at 也可为 null. 不返回 Customer ID, 邮箱, 地址, 发票下载 URL 或门户链接. 无 Customer 返回 409/15045, 读取失败为 503/15046, 映射冲突为 503/15047, 不以空列表掩盖错误. 发票不等同于本地入账记录.
鉴权
Authorizationstring请求头必填使用系统访问令牌, 格式为 Bearer YOUR_SYSTEM_ACCESS_TOKEN. 模型 API Key 不能用于此接口, 无需 X-User-Id.
请求参数
invoice_idstring路径必填Stripe 发票 ID, 以 in_ 开头.
约束: maxLength=255; pattern=^in_[A-Za-z0-9_]+$.
请求示例
curl --request GET \
--url 'https://toapis.com/api/v1/account/billing/invoices/in_example_01' \
--header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'import requests
response = requests.get(
"https://toapis.com/api/v1/account/billing/invoices/in_example_01",
headers={"Authorization": "Bearer YOUR_SYSTEM_ACCESS_TOKEN"},
timeout=30,
)
response.raise_for_status()
print(response.json())const url = new URL("https://toapis.com/api/v1/account/billing/invoices/in_example_01");
const response = await fetch(url, {
headers: { Authorization: "Bearer YOUR_SYSTEM_ACCESS_TOKEN" },
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());响应字段
示例使用虚构数据. 金额样例假设 credits_per_usd="100", 实际换算以响应为准.
codeinteger业务状态码, 成功时为 0.
messagestring响应消息, 成功时为空字符串. 错误消息会按请求语言返回.
dataobject本次查询的结果对象.
data.idstringStripe 发票 ID, 用于查询发票详情.
data.providerstring支付服务提供方. 固定值: "stripe".
data.numberstring | nullStripe 发票编号, 与发票 ID 不同. 无法确认或不适用时为 null.
data.statusstringStripe 返回的发票状态.
data.created_atstring | null创建时间. 时间格式为带时区的 RFC 3339. 无法确认或不适用时为 null.
data.currencystring金额采用的原币种.
data.subtotalstring发票小计, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.totalstring发票总额, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.amount_duestring发票应付金额, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.amount_paidstring发票已付金额, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.amount_remainingstring发票剩余应付金额, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.paid_atstring | nullStripe 记录的发票支付完成时间. 时间格式为带时区的 RFC 3339. 无法确认或不适用时为 null.
data.platform_trade_nonull可靠关联的本地充值订单号, 无法确认关联时为 null.
data.metaobject数据来源, 查询范围和数据口径等元信息.
data.meta.sourcestring数据来源. 本地配置或账本快照不表示 Stripe 实时状态. 固定值: "stripe".
data.meta.coveragestring发票覆盖范围, 仅当前已验证的 Stripe Customer, 不代表全部历史. 固定值: "current_customer_only".
data.meta.scopestring查询的数据归属范围, 当前为认证账户自身. 固定值: "self".
data.meta.fetched_atstring本次从 Stripe 读取发票数据的时间, 不是发票创建时间. 时间格式为带时区的 RFC 3339.
响应示例
{
"code": 0,
"message": "",
"data": {
"id": "in_example_01",
"provider": "stripe",
"number": "EXAMPLE-0001",
"status": "paid",
"created_at": "2026-11-01T08:00:00Z",
"currency": "USD",
"subtotal": "10",
"total": "10",
"amount_due": "10",
"amount_paid": "10",
"amount_remaining": "0",
"paid_at": "2026-11-01T08:01:00Z",
"platform_trade_no": null,
"meta": {
"source": "stripe",
"coverage": "current_customer_only",
"scope": "self",
"fetched_at": "2026-11-02T01:00:00Z"
}
}
}