ToAPIsToAPIs
帳戶查詢帳單

取得發票詳情

使用系統存取權杖讀取目前帳戶的資料

GET
/api/v1/account/billing/invoices/%7Binvoice_id%7D

中國大陸用戶請注意: 中國大陸用戶請使用 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.

請求參數

invoice_idstring路徑必填

以 in_ 開頭的 Stripe 發票 ID.

限制: 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.idstring

Stripe 發票 ID, 用於查詢發票詳情.

data.providerstring

付款服務提供方. 固定值: "stripe".

data.numberstring | null

Stripe 發票編號, 與發票 ID 不同. 無法確認或不適用時為 null.

data.statusstring

Stripe 回傳的發票狀態.

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 | null

Stripe 記錄的發票付款完成時間. 時間格式為含時區的 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"
    }
  }
}