POST
/v1/tokensTokenization
Converts raw card data into a safe token. Used by your Card Container to securely handle sensitive payment information without exposing it to your servers.
Overview
The tokenization endpoint allows you to securely convert card details into a temporary token that can be used for payment processing. This keeps sensitive card data out of your system and maintains PCI-DSS compliance.
Important:
- Tokens expire after 24 hours
- Each token can only be used once for payment processing
- Never store raw card data on your servers
- This endpoint should be called from your frontend Card Container
Request
Request Body
All fields are required
card_numberThe card number (13-19 digits)
expiry_monthTwo-digit month (01-12)
expiry_yearFour-digit year (e.g., 2025)
cvv3-4 digit CVV code
cardholder_nameName on the card
Code Examples
curl -X POST "https://api.altafinex.com/v1/tokens" \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"card_number": "4111111111111111",
"expiry_month": "12",
"expiry_year": "2025",
"cvv": "123",
"cardholder_name": "John Doe"
}'Response
Status Codes
200
Token created successfully400
Invalid request data401
Authentication failed422
Card validation failedSuccess Response
Example response for a successful request
{
"token_id": "tok_1234567890abcdef",
"expires_at": "2025-12-31T23:59:59Z",
"last4": "1111",
"brand": "visa"
}Error Response
Example response for an error
{
"error": {
"code": "invalid_card",
"message": "The card number provided is invalid",
"type": "card_error"
}
}