列出发票
使用系统访问令牌读取当前账户的数据
国内用户请注意: 中国大陆用户请使用 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.
请求参数
fromstring查询带时区的 RFC 3339 起始时间, 包含该时刻. 与 to 成对提供.
约束: date-time.
tostring查询带时区的 RFC 3339 结束时间, 不包含该时刻, 必须晚于 from.
约束: date-time.
cursorstring查询原样传入上一页的 next_cursor. 保留原筛选条件, 改变条件后重新开始.
约束: maxLength=2048.
limitinteger查询默认值: 20每页最多返回的条目数.
约束: minimum=1; maximum=100; 默认值: 20.
请求示例
curl --request GET \
--url 'https://toapis.com/api/v1/account/billing/invoices?from=2026-11-01T00:00:00Z&to=2026-11-02T00:00:00Z&limit=20' \
--header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'import requests
response = requests.get(
"https://toapis.com/api/v1/account/billing/invoices",
headers={"Authorization": "Bearer YOUR_SYSTEM_ACCESS_TOKEN"},
params={
"from": "2026-11-01T00:00:00Z",
"to": "2026-11-02T00:00:00Z",
"limit": "20"
},
timeout=30,
)
response.raise_for_status()
print(response.json())const url = new URL("https://toapis.com/api/v1/account/billing/invoices");
url.search = new URLSearchParams({
"from": "2026-11-01T00:00:00Z",
"to": "2026-11-02T00:00:00Z",
"limit": "20"
}).toString();
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", 实际换算以响应为准.
列表位于 data.items, 使用 has_more 和 next_cursor 翻页. 末页游标为 null, 不返回总数.
codeinteger业务状态码, 成功时为 0.
messagestring响应消息, 成功时为空字符串. 错误消息会按请求语言返回.
dataobject本次查询的结果对象.
data.itemsobject[]当前页的记录列表, 空结果为 [].
data.items[].idstringStripe 发票 ID, 用于查询发票详情.
data.items[].providerstring支付服务提供方. 固定值: "stripe".
data.items[].numberstring | nullStripe 发票编号, 与发票 ID 不同. 无法确认或不适用时为 null.
data.items[].statusstringStripe 返回的发票状态.
data.items[].created_atstring | null创建时间. 时间格式为带时区的 RFC 3339. 无法确认或不适用时为 null.
data.items[].currencystring金额采用的原币种.
data.items[].subtotalstring发票小计, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.items[].totalstring发票总额, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.items[].amount_duestring发票应付金额, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.items[].amount_paidstring发票已付金额, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.items[].amount_remainingstring发票剩余应付金额, 单位为 currency 指定的原币种. 以十进制字符串返回以保持精度.
data.items[].paid_atstring | nullStripe 记录的发票支付完成时间. 时间格式为带时区的 RFC 3339. 无法确认或不适用时为 null.
data.items[].platform_trade_nonull可靠关联的本地充值订单号, 无法确认关联时为 null.
data.has_moreboolean是否还有下一页.
data.next_cursorstring | null下一页游标, 原样作为 cursor 传入并保留筛选条件. 末页为 null.
data.metaobject数据来源, 查询范围和数据口径等元信息.
data.meta.sourcestring数据来源. 本地配置或账本快照不表示 Stripe 实时状态.
data.meta.coveragestring发票覆盖范围, 仅当前已验证的 Stripe Customer, 不代表全部历史.
data.meta.scopestring查询的数据归属范围, 当前为认证账户自身.
data.meta.fetched_atstring本次从 Stripe 读取发票数据的时间, 不是发票创建时间.
data.meta.fromstring查询时间范围的下界, 包含该时刻.
data.meta.tostring查询时间范围的上界, 不包含该时刻.
响应示例
{
"code": 0,
"message": "",
"data": {
"items": [
{
"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
}
],
"has_more": false,
"next_cursor": null,
"meta": {
"source": "stripe",
"coverage": "current_customer_only",
"scope": "self",
"fetched_at": "2026-11-02T01:00:00Z",
"from": "2026-11-01T00:00:00Z",
"to": "2026-11-02T00:00:00Z"
}
}
}