Get payment method
Read your account data with a system access token
Note for users in mainland China: Please use https://toapis.cn as the API endpoint (Base URL). Replace https://toapis.com with https://toapis.cn in the examples in this document.
See Getting started for authentication, pagination, and errors.
Behavior
Only a main account can read its own billing. Subaccounts receive HTTP 403. A main account cannot read member billing through this endpoint.
source=local_configuration is a local default-card summary, not a live Stripe query or a list of all cards. When unconfigured, configured=false and other card fields are null. Missing masked fields can remain null even when configured. Full card numbers and payment-method IDs are not returned. GET does not attach cards or create Customers.
Authentication
AuthorizationstringheaderrequiredUse Bearer YOUR_SYSTEM_ACCESS_TOKEN. Model API keys are not accepted. X-User-Id is not required.
Parameters
This endpoint accepts no path or query parameters and requires no request body.
requestExample
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());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".
responseExample
{
"code": 0,
"message": "",
"data": {
"configured": true,
"provider": "stripe",
"type": "card",
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2028,
"source": "local_configuration"
}
}