Overview
Tokens allow you to securely collect card details on your own payment form. Card data is tokenized in the browser using the JavaScript SDK and your publishable key, so raw card numbers never reach your server.Create Token
POST /v1/tokens
Authentication: Publishable key (pk_test_* / pk_live_*) via Bearer token
You can call this endpoint directly with
fetch or any HTTP client. The JavaScript SDK is optional — it provides client-side validation and a simpler API, but is not required.Request Parameters
Card details object
Response
Token ID (
tok_ prefix). Valid for 30 minutes, single use.Masked card details
Connector ID used for tokenization
Creation timestamp (ISO 8601)
Expiration timestamp (ISO 8601). 30 minutes after creation.
Token Errors
| Code | HTTP Status | Description |
|---|---|---|
validation_error | 400 | Invalid card details (number, expiry, CVC) |
tokenization_failed | 400 | Failed to tokenize card data |
payment_token_expired | 400 | Token has expired (30 minute limit) |
payment_token_already_used | 400 | Token has already been used for a payment |
Using a Token for Payment
After creating a token, pass it toPOST /v1/payments:
JavaScript SDK
The JavaScript SDK is an optional convenience wrapper that provides client-side card validation and a simpler API.The SDK returns the token ID as
token (the API response field is id — the SDK renames it for convenience).