API REFERENCE
Get Default Payment Method
On this page
/api/accounts/{id}/payment-methodRetrieve the default payment method on file for an account. Returns card: null when no payment method has been saved yet — the top-up dialog uses this to decide whether to show a pre-charge confirmation (card present) or route to a checkout session to collect one (card: null). Cards are returned even when expired; callers should compare exp_month / exp_year against the current date and warn the customer, since an off-session charge against an expired card will decline.
Authentication
x-api-key in header
bearerAuth bearer
Request
curl --request GET \
--url 'https://api.recoupable.dev/api/accounts/YOUR_ID/payment-method' \
--header 'x-api-key: YOUR_API_KEY'Replace the YOUR_ placeholders with your values. Required query parameters are included; optional parameters are listed below.
Parameters
Path parameters
idstringrequiredThe unique identifier (UUID) of the account. Must be the authenticated account or another accessible via organization membership.
Responses
200Default payment method retrieved successfully (may be null if none on file).+
application/json
account_idstringrequiredThe unique identifier of the account this payment method belongs to.
format: uuid
cardone ofrequiredDefault card on file. null when the account has never saved a payment method — the top-up flow will route through a checkout session in that case.
Properties for card
oneOf · SavedCard 1
brandstringrequiredCard brand. Common values: visa, mastercard, amex, discover, diners, jcb, unionpay, unknown.
last4stringrequiredLast four digits of the card number. Safe to display in UI for identification.
pattern: ^\d{4}$
exp_monthintegerrequiredCard expiration month (1-12). Compare against the current month to detect expired cards.
minimum: 1 · maximum: 12
exp_yearintegerrequiredCard expiration year (full 4-digit year). Compare against the current year to detect expired cards.
fundingstringrequiredFunding type. Common values: credit, debit, prepaid, unknown.
oneOf · null 2
null
401Unauthorized - invalid or missing authentication+
application/json
errorstringrequiredHuman-readable error message.
{
"error": "Unauthorized"
}403Forbidden - the account is not the caller's and not an organization they belong to (an unknown id also returns 403, never 404)+
application/json
errorstringrequiredHuman-readable error message.
Full specification
Download the OpenAPI file for complete schemas, constraints, and examples.
Download accounts.jsonView operation source
{
"description": "Retrieve the default payment method on file for an account. Returns `card: null` when no payment method has been saved yet — the top-up dialog uses this to decide whether to show a pre-charge confirmation (card present) or route to a checkout session to collect one (`card: null`). Cards are returned even when expired; callers should compare `exp_month` / `exp_year` against the current date and warn the customer, since an off-session charge against an expired card will decline.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The unique identifier (UUID) of the account. Must be the authenticated account or another accessible via organization membership.",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"security": [
{
"apiKeyAuth": []
},
{
"bearerAuth": []
}
],
"responses": {
"200": {
"description": "Default payment method retrieved successfully (may be `null` if none on file).",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountPaymentMethodResponse"
}
}
}
},
"401": {
"description": "Unauthorized - invalid or missing authentication",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountPaymentMethodErrorResponse"
},
"example": {
"error": "Unauthorized"
}
}
}
},
"403": {
"description": "Forbidden - the account is not the caller's and not an organization they belong to (an unknown id also returns 403, never 404)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AccountPaymentMethodErrorResponse"
}
}
}
}
}
}