ToAPIsToAPIs
Account QueriesBilling

Get payment method

Read your account data with a system access token

GET
/api/v1/account/billing/payment-method

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

Authorizationstringheaderrequired

Use 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.

codeinteger

Numeric result code; 0 means success.

messagestring

Response message; empty on success. Error messages are localized.

dataobject

Result object for this query.

data.configuredboolean

Whether a default card is configured. If false, card-summary fields are null.

data.providerstring | null

Payment service provider. null when unknown or inapplicable.

data.typestring | null

Default payment method type, such as card. null when unknown or inapplicable.

data.brandstring | null

Default card brand, such as visa. null when unknown or inapplicable.

data.last4string | null

Last four digits of the default card, never the full number. null when unknown or inapplicable.

data.exp_monthinteger | null

Default card expiration month. null when unknown or inapplicable.

data.exp_yearinteger | null

Default card expiration year. null when unknown or inapplicable.

data.sourcestring

Data 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"
  }
}