/api/payment-gateway/tokenize-card endpoint allows you to securely vault a customer’s credit card with CertoPay and receive a short opaque cardToken in return. On every subsequent charge for that customer, pass the token in the cardToken field of POST /api/payment-gateway/process instead of transmitting raw card data — keeping sensitive PAN information off your servers and simplifying your PCI-DSS compliance scope.
Base URL
Endpoint
Request Headers
Your secret API key. This must be kept server-side at all times.
Must be
application/json.Request Body
Your internal identifier for the customer (UUID recommended). CertoPay associates the resulting token with this ID so you can manage multiple cards per customer.
The cardholder’s CPF (Cadastro de Pessoas Físicas), digits only. Example:
"12345678900".Full name exactly as it appears on the card, in uppercase. Example:
"JOAO DA SILVA".16-digit card PAN, digits only. Example:
"4111111111111111".Card network brand. Accepted values:
"Visa", "Mastercard", "Elo".Two-digit expiration month. Example:
"12".Two-digit expiration year. Example:
"28" for 2028.Card CVV/CVC security code. Example:
"123".The cardholder’s date of birth in
YYYY-MM-DD format. Used for anti-fraud verification. Example: "1990-05-20".The cardholder’s mobile phone number in Brazilian format. Example:
"(11) 99999-9999".The cardholder’s billing address. Must match the address on file with the card issuer for AVS checks.
Example Request
Response Fields
An opaque token that represents the stored card. This value is safe to persist in your database and pass to future
POST /api/payment-gateway/process requests in the cardToken field. It does not encode any recoverable card data.Example Response
Error Responses
| HTTP Status | Meaning |
|---|---|
400 Bad Request | A required field is missing or malformed. Check the errors array in the response body for field-level details. |
401 Unauthorized | The X-Api-Key header is missing or invalid. |
422 Unprocessable Entity | The card data was rejected during validation (e.g. expired card, invalid CVV). |
500 Internal Server Error | An unexpected error occurred on CertoPay’s side. Retry with exponential back-off. |