取得發票詳情
按發票 ID 查詢發票詳情
中國大陸用戶請注意: 中國大陸用戶請使用 https://api.toapis.cn 作為接口地址 (Base URL). 文檔示例中的 https://api.toapis.com 請替換為 https://api.toapis.cn.
驗證, 分頁及錯誤處理請參閱接入方式.
使用說明
按發票 ID 查詢單張 Stripe 發票的詳情. 僅主帳號可查詢自身帳單; 子帳號存取回傳 HTTP 403, 主帳號也不能藉此查詢成員帳單.
回應的發票欄位與清單項一致, data.meta 額外回傳讀取來源, Customer 涵蓋範圍和讀取時間. 每次取得都會重新校驗發票是否屬於目前 Customer: 屬於他人或不存在的發票統一回傳 404. 不回傳 hosted_invoice_url, invoice_pdf 或 Customer ID.
欄位含義見列出發票.
驗證
Authorizationstring請求頭必填使用系統存取權杖, 格式為 Bearer YOUR_SYSTEM_ACCESS_TOKEN. 此介面不接受模型 API Key, 不需要 X-User-Id.
請求參數
invoice_idstring路徑必填以 in_ 開頭的 Stripe 發票 ID.
限制: maxLength=255; pattern=^in_[A-Za-z0-9_]+$.
請求範例
請求示例
curl --request GET \
--url 'https://api.toapis.com/api/v1/billing/stripe/invoices/in_example_01' \
--header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'import requests
response = requests.get(
"https://api.toapis.com/api/v1/billing/stripe/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://api.toapis.com/api/v1/billing/stripe/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"
}
}
}