查詢付款方式
使用系統存取權杖讀取目前帳戶的資料
中國大陸用戶請注意: 中國大陸用戶請使用 https://toapis.cn 作為接口地址 (Base URL). 文檔示例中的 https://toapis.com 請替換為 https://toapis.cn.
驗證, 分頁及錯誤處理請參閱接入說明.
使用說明
僅主帳戶可查詢自身帳單. 子帳戶存取時回傳 HTTP 403, 主帳戶也不能查詢成員帳單.
source=local_configuration 為本地預設卡片摘要, 並非 Stripe 即時查詢或全部卡片清單. 未綁定時 configured=false, 其他卡片欄位為 null; 已綁定但缺失的欄位也可為 null. 不回傳完整卡號或付款方式 ID, GET 不綁卡或建立 Customer.
驗證
Authorizationstring請求頭必填使用系統存取權杖, 格式為 Bearer YOUR_SYSTEM_ACCESS_TOKEN. 此介面不接受模型 API Key, 不需要 X-User-Id.
請求參數
此介面不接受路徑或查詢參數, 不需要請求主體.
請求示例
curl --request GET \
--url 'https://toapis.com/api/v1/account/billing/payment-method' \
--header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'import requests
response = requests.get(
"https://toapis.com/api/v1/account/billing/payment-method",
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/payment-method");
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.configuredboolean是否已設定預設付款卡. 為 false 時卡片摘要欄位均為 null.
data.providerstring | null付款服務提供方. 無法確認或不適用時為 null.
data.typestring | null預設付款方式的類型, 如 card. 無法確認或不適用時為 null.
data.brandstring | null預設卡片品牌, 如 visa. 無法確認或不適用時為 null.
data.last4string | null預設卡號末 4 位, 不回傳完整卡號. 無法確認或不適用時為 null.
data.exp_monthinteger | null預設卡片到期月份. 無法確認或不適用時為 null.
data.exp_yearinteger | null預設卡片到期年份. 無法確認或不適用時為 null.
data.sourcestring資料來源. 本地設定或帳本快照不代表 Stripe 即時狀態. 固定值: "local_configuration".
響應示例
{
"code": 0,
"message": "",
"data": {
"configured": true,
"provider": "stripe",
"type": "card",
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2028,
"source": "local_configuration"
}
}