查詢自動儲值設定
查詢自動儲值設定與執行狀態
中國大陸用戶請注意: 中國大陸用戶請使用 https://api.toapis.cn 作為接口地址 (Base URL). 文檔示例中的 https://api.toapis.com 請替換為 https://api.toapis.cn.
驗證, 分頁及錯誤處理請參閱接入方式.
使用說明
回傳自動充值的設定和執行狀態, 用於排查自動充值為何沒有觸發. 僅主帳號可查詢自身帳單; 子帳號存取回傳 HTTP 403, 主帳號也不能藉此查詢成員帳單.
enabled 是使用者設定的開關, status 是實際執行狀態 (會同時反映暫停, 缺卡, 待驗證和重試等情況), 兩者含義不同. threshold_credits 是觸發自動儲值的餘額閾值, configured_amount_usd 是設定的儲值金額 (美元), 都不代表實際扣款或入帳金額. 未知時間回傳 null.
reason 解釋目前狀態的原因, 可能為 card_unbound, charge_failed, verification_required, failure_limit, missing_payment_method, billing_not_linked, configuration_review_required 或 null.
action_required 表示需要使用者互動處理. 本介面不會發起扣款.
驗證
Authorizationstring請求頭必填使用系統存取權杖, 格式為 Bearer YOUR_SYSTEM_ACCESS_TOKEN. 此介面不接受模型 API Key, 不需要 X-User-Id.
請求參數
此介面不接受路徑或查詢參數, 不需要請求主體.
請求範例
請求示例
curl --request GET \
--url 'https://api.toapis.com/api/v1/billing/auto-topup' \
--header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'import requests
response = requests.get(
"https://api.toapis.com/api/v1/billing/auto-topup",
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/auto-topup");
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.enabledboolean自動儲值的設定開關, 與執行狀態 status 分開表達.
data.statusstring自動儲值執行狀態, 反映啟用, 暫停, 驗證, 缺卡或等待重試. 可選值: active, paused, requires_action, missing_payment_method, retry_wait.
data.threshold_creditsstring觸發自動儲值的餘額門檻, 單位為 credits. 以十進位字串回傳以保留精度.
data.configured_amount_usdstring設定的自動儲值 USD 金額, 不保證最終扣款或入帳值. 以十進位字串回傳以保留精度.
data.last_attempt_atstring | null最近一次自動儲值嘗試時間. 時間格式為含時區的 RFC 3339. 無法確認或不適用時為 null.
data.last_success_atstring | null最近一次自動儲值成功時間. 時間格式為含時區的 RFC 3339. 無法確認或不適用時為 null.
data.next_retry_atstring | null下一次自動儲值重試時間. 時間格式為含時區的 RFC 3339. 無法確認或不適用時為 null.
data.action_requiredboolean是否需要使用者互動處理. 本次 GET 不會發起付款.
data.reasonstring | null自動儲值狀態的原因代碼, 無額外原因時為 null.
data.sourcestring資料來源. 本地設定或帳本快照不代表 Stripe 即時狀態. 固定值: "local_configuration".
回應範例
響應示例
{
"code": 0,
"message": "",
"data": {
"enabled": true,
"status": "active",
"threshold_credits": "100",
"configured_amount_usd": "10",
"last_attempt_at": "2026-11-01T08:00:00Z",
"last_success_at": "2026-11-01T08:01:00Z",
"next_retry_at": null,
"action_required": false,
"reason": null,
"source": "local_configuration"
}
}