列出發票
使用系統存取權杖讀取目前帳戶的資料
中國大陸用戶請注意: 中國大陸用戶請使用 https://toapis.cn 作為接口地址 (Base URL). 文檔示例中的 https://toapis.com 請替換為 https://toapis.cn.
驗證, 分頁及錯誤處理請參閱接入說明.
使用說明
僅主帳戶可查詢自身帳單. 子帳戶存取時回傳 HTTP 403, 主帳戶也不能查詢成員帳單.
預設最近 31 天, 最長 366 天. 僅涵蓋目前已驗證 Customer, meta.coverage=current_customer_only, 並非所有歷史; 對應變更後舊游標失效. 金額依 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, 電子郵件, 地址, 發票下載或入口連結. 無對應為 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"
}
}
}