查询支付方式
使用系统访问令牌读取当前账户的数据
国内用户请注意: 中国大陆用户请使用 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"
}
}