A credit card payment happens in two steps, in this order:
- Tokenization — the sensitive card data (number, CVV, expiry) is exchanged for a
token, and that token — never the card number — is what travels to the payment API. - Payment — the token is sent to
POST /v1/payments/credit-card, along withorder_idandcustomer_id, to complete the charge.
Testing in sandbox? Check the test cards at the end of this page.
Tokenizing from the front-end?
At checkout, tokenization is usually done by appmax.js via CDN — see Appmax JS. The endpoint in step 1 documents the underlying contract, useful for custom implementations (without the script) and for debugging.
1. Tokenization
Credit card tokenization
Replaces the actual card data (number, CVV, expiration date) with a unique, secure token, allowing you to run transactions without exposing the original information.
Server-side tokenization requires PCI-DSS
When you tokenize through your backend, your server handles the card number and CVV in plain text. This is only allowed if your architecture is within PCI-DSS scope. If you're not sure, use the CDN path — the Appmax JS script keeps sensitive data away from your server.
There are two distinct authentication paths for this endpoint:
via CDN (external-id header) or via backend (Authorization: Bearer header). See external-id for context.
Authorizations
Bearer token of the merchant obtained via POST /oauth2/token using the
merchant's credentials (not the app's). See
Authentication.
Request Body
Responses
Token generated successfully.
Samples
2. Payment
Credit card payment
Creates a credit card payment linked to an existing order. Supports installments and soft descriptor customization.
WARNING
Before creating a payment, you need to have:
order_id— the order ID (create an order)customer_id— the customer ID (create a customer)
INFO
See Get installments to get the correct amounts with the configured fees before sending an installment payment.
Authorizations
Bearer token of the merchant obtained via POST /oauth2/token using the
merchant's credentials (not the app's). See
Authentication.
Request Body
Responses
Payment created successfully.
Samples
Test cards
To test the flow in the sandbox environment, use the cards below with a future expiration date:
| Card number | Scenario |
|---|---|
4000000000000010 | Approved and captured. The order becomes aprovado, with paid_at and captured_at set. |
4000000000000028 | Approved without capture (pre-authorization). The order becomes autorizado, captured_at null. |
4000000000000002 | Declined by the issuer. The payment returns an error and the order is canceled. |
4000000000000036 | Transaction error. Processing failure; the payment returns an error. |
4000000000000044 | Order failed. The order fails at the gateway; the payment returns an error. |
4000000000009999 | Gateway unavailable. Simulates a payment-provider outage. |
| Any other card | Declined. |
The scenarios work both when sending the card data directly to POST /v1/payments/credit-card and in the tokenized flow (POST /v1/payments/tokenize, then paying with the token): a token minted from a test card reproduces that card's scenario.
Testing Pix or boleto? They don't use test cards: in the sandbox they are approved automatically, and there are specific documents to keep the order pending. See Testing Pix and boleto in the sandbox.
TIP
Use card 4000000000000010 to test the full successful payment flow, and card 4000000000000002 to test payment error handling. Note that 4000000000000028 approves the transaction, it just does not capture it.