Affirm Cards API
Operations for managing virtual card numbers (VCN) issued via the Affirm Lite integration pattern.
Operations for managing virtual card numbers (VCN) issued via the Affirm Lite integration pattern.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/affirm-cards-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Affirm Direct Cards API
description: The Affirm Direct API is a flexible integration that allows merchants to embed the full Affirm checkout and payment authorization flow directly into their website, giving complete control over the front-end user experience and back-end transaction processing logic. It supports inline checkout via modal or redirect to affirm.com, and handles the full transaction lifecycle including authorization, capture, void, and refund operations. This spec covers the server-side endpoints used in the Direct API integration pattern, including the checkout token exchange for authorization and subsequent transaction management operations. Authentication is handled via HTTP Basic Authentication using API keys from the Affirm Merchant Portal.
version: '1.0'
contact:
name: Affirm Developer Support
url: https://docs.affirm.com/developers/docs/development-quickstart
termsOfService: https://www.affirm.com/legal/merchant-terms
servers:
- url: https://api.affirm.com/api/v1
description: Production Server
- url: https://sandbox.affirm.com/api/v1
description: Sandbox Server
security:
- basicAuth: []
tags:
- name: Cards
description: Operations for managing virtual card numbers (VCN) issued via the Affirm Lite integration pattern.
paths:
/cards/{id}:
get:
operationId: readCard
summary: Affirm Read a Card
description: Retrieves the details of a virtual card number (VCN) issued via Affirm Lite. Returns card number, expiration, CVV, and billing address information needed for payment processing through traditional card networks.
tags:
- Cards
parameters:
- $ref: '#/components/parameters/CardId'
responses:
'200':
description: Card retrieved successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Card'
examples:
readCard200Example:
summary: Default readCard 200 response
x-microcks-default: true
value:
id: '500123'
checkout_id: '500123'
status: active
number: example_value
cvv: example_value
expiration: example_value
billing:
address:
line1: {}
city: {}
state: {}
zipcode: {}
country: {}
amount: 1
currency: USD
created: '2025-03-15T14:30:00Z'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/cards/{id}/cancel:
post:
operationId: cancelCard
summary: Affirm Cancel a Card
description: Cancels a virtual card number (VCN) issued via Affirm Lite, rendering it unusable for further charges. Used when an order is cancelled or the card is no longer needed.
tags:
- Cards
parameters:
- $ref: '#/components/parameters/CardId'
responses:
'200':
description: Card cancelled successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Card'
examples:
cancelCard200Example:
summary: Default cancelCard 200 response
x-microcks-default: true
value:
id: '500123'
checkout_id: '500123'
status: active
number: example_value
cvv: example_value
expiration: example_value
billing:
address:
line1: {}
city: {}
state: {}
zipcode: {}
country: {}
amount: 1
currency: USD
created: '2025-03-15T14:30:00Z'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/cards/{id}/finalize:
post:
operationId: finalizeCard
summary: Affirm Finalize a Card
description: Finalizes a virtual card number (VCN), updating the card details with the final purchase amount and completing the Affirm Lite transaction lifecycle.
tags:
- Cards
parameters:
- $ref: '#/components/parameters/CardId'
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
amount:
type: integer
description: Final authorized amount in cents.
order_id:
type: string
description: Merchant order identifier for this finalization.
examples:
finalizeCardRequestExample:
summary: Default finalizeCard request
x-microcks-default: true
value:
amount: 1
order_id: '500123'
responses:
'200':
description: Card finalized successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/Card'
examples:
finalizeCard200Example:
summary: Default finalizeCard 200 response
x-microcks-default: true
value:
id: '500123'
checkout_id: '500123'
status: active
number: example_value
cvv: example_value
expiration: example_value
billing:
address:
line1: {}
city: {}
state: {}
zipcode: {}
country: {}
amount: 1
currency: USD
created: '2025-03-15T14:30:00Z'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
components:
responses:
Unauthorized:
description: Unauthorized. Authentication credentials are missing or invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: Not found. The requested resource does not exist.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
BadRequest:
description: Bad request. The request body or parameters are invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
parameters:
CardId:
name: id
in: path
required: true
description: The unique identifier of the virtual card.
schema:
type: string
schemas:
Card:
type: object
description: Represents an Affirm-issued virtual card number (VCN) used in the Affirm Lite integration pattern to process payments through traditional card networks.
properties:
id:
type: string
description: Unique identifier for this virtual card.
example: '500123'
checkout_id:
type: string
description: Checkout session identifier associated with this card.
example: '500123'
status:
type: string
description: Current status of the virtual card.
enum:
- active
- cancelled
- finalized
example: active
number:
type: string
description: Virtual card number (PAN).
example: example_value
cvv:
type: string
description: Card verification value.
example: example_value
expiration:
type: string
description: Card expiration date in MM/YY format.
example: example_value
billing:
type: object
description: Billing address associated with this virtual card.
properties:
address:
type: object
properties:
line1:
type: string
description: Street address line 1.
city:
type: string
description: City.
state:
type: string
description: State code.
zipcode:
type: string
description: ZIP or postal code.
country:
type: string
description: ISO 3166-1 alpha-2 country code.
example:
address:
line1: example_value
city: example_value
state: example_value
zipcode: example_value
country: example_value
amount:
type: integer
description: Authorized amount on this virtual card in cents.
example: 1
currency:
type: string
description: ISO 4217 currency code.
example: USD
created:
type: string
format: date-time
description: Card creation timestamp in RFC 3339 format.
example: '2025-03-15T14:30:00Z'
Error:
type: object
description: Standard error response returned by the Affirm API.
properties:
status_code:
type: integer
description: HTTP status code of the error.
example: 1
code:
type: string
description: Machine-readable error code string.
example: example_value
message:
type: string
description: Human-readable description of the error.
example: example_value
securitySchemes:
basicAuth:
type: http
scheme: basic
description: HTTP Basic Authentication using the merchant's public API key as the username and private API key as the password, Base64-encoded as per RFC 7617.
externalDocs:
description: Affirm Direct API Overview
url: https://docs.affirm.com/payments/docs/direct-api-overview