Skip to content

A credit card payment happens in two steps, in this order:

  1. Tokenization — the sensitive card data (number, CVV, expiry) is exchanged for a single-use token. It is this token, never the card number, that travels to the payment API.
  2. Payment — the token is sent to POST /v1/payments/credit-card, along with order_id and customer_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

2. Payment

Test cards

To test the flow in the sandbox environment, use the cards below with a future expiration date:

Card numberScenario
4000000000000010Approved and captured. The order becomes aprovado, with paid_at and captured_at set.
4000000000000028Approved without capture (pre-authorization). The order becomes autorizado, captured_at null.
4000000000000002Declined by the issuer. The payment returns an error and the order is canceled.
4000000000000036Transaction error. Processing failure; the payment returns an error.
4000000000000044Order failed. The order fails at the gateway; the payment returns an error.
4000000000009999Gateway unavailable. Simulates a payment-provider outage.
Any other cardDeclined.

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.

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.