POST
/v1/customers

Vaulting

Saves a card token for future "one-click" checkouts. This allows customers to save their payment methods for faster checkout experiences.

Overview

The vaulting feature allows you to securely store customer payment methods. After tokenizing a card, you can save it to a customer profile for future use. This enables one-click checkout and subscription payments.

Use Cases:

  • One-click checkout for returning customers
  • Subscription and recurring payments
  • Faster checkout experiences
  • Multiple payment methods per customer

Request

Request Body
Required and optional fields
token_id
required

The token ID from the tokenization endpoint

customer_id
required

Your unique identifier for the customer

metadata
optional

Additional customer information (email, name, etc.)

Code Examples

curl -X POST "https://api.altafinex.com/v1/customers" \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "token_id": "tok_1234567890abcdef",
  "customer_id": "cust_12345",
  "metadata": {
    "email": "customer@example.com",
    "name": "John Doe"
  }
}'

Response

Status Codes

200
Card saved successfully
400
Invalid request data
401
Authentication failed
422
Token expired or invalid
Success Response
Example response for a successful request
{
  "customer_id": "cust_12345",
  "card_token": "card_1234567890abcdef",
  "last4": "1111",
  "brand": "visa",
  "expiry_month": 12,
  "expiry_year": 2025,
  "created_at": "2024-01-15T10:00:00Z"
}
Error Response
Example response for an error
{
  "error": {
    "code": "token_expired",
    "message": "The token has expired or is invalid",
    "type": "token_error"
  }
}

Related Endpoints