Get payment method
Read the locally recorded default payment method
Note for users in mainland China: Please use https://api.toapis.cn as the API endpoint (Base URL). Replace https://api.toapis.com with https://api.toapis.cn in the examples in this document.
See Access for authentication, pagination, and errors.
Behavior
Returns the currently bound payment method summary, for checking whether a card is configured. Only the main account can query its own billing; sub-accounts get HTTP 403, and a main account cannot use this endpoint to query member bills.
source=local_configuration means the response is the locally stored default-card summary, not a live Stripe query or a list of all cards. When no payment method is bound, configured=false and the other card fields are null. When bound, individual fields may still be null.
The full card number and payment-method ID are not returned. This endpoint is read-only — it cannot bind a card or create a Stripe Customer.
Authentication
AuthorizationstringheaderrequiredUse Bearer YOUR_SYSTEM_ACCESS_TOKEN. Model API keys are not accepted. X-User-Id is not required.
Request parameters
This endpoint accepts no path or query parameters and requires no request body.
Request examples
requestExample
curl --request GET \
--url 'https://api.toapis.com/api/v1/billing/payment-method' \
--header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'import requests
response = requests.get(
"https://api.toapis.com/api/v1/billing/payment-method",
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/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());Response fields
Examples use fictional data and assume credits_per_usd="100". Use the conversion rate returned by the API.
codeintegerNumeric result code; 0 means success.
messagestringResponse message; empty on success. Error messages are localized.
dataobjectResult object for this query.
data.configuredbooleanWhether a default card is configured. If false, card-summary fields are null.
data.providerstring | nullPayment service provider. null when unknown or inapplicable.
data.typestring | nullDefault payment method type, such as card. null when unknown or inapplicable.
data.brandstring | nullDefault card brand, such as visa. null when unknown or inapplicable.
data.last4string | nullLast four digits of the default card, never the full number. null when unknown or inapplicable.
data.exp_monthinteger | nullDefault card expiration month. null when unknown or inapplicable.
data.exp_yearinteger | nullDefault card expiration year. null when unknown or inapplicable.
data.sourcestringData source. Local configuration or ledger snapshots do not imply live Stripe state. Fixed value: "local_configuration".
Response examples
responseExample
{
"code": 0,
"message": "",
"data": {
"configured": true,
"provider": "stripe",
"type": "card",
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2028,
"source": "local_configuration"
}
}