Reference

Statuses, identifiers, payment methods, redirect URLs and error codes for Hosted Checkout.

Reference for Hosted Checkout statuses, identifiers, payment methods, redirects and errors.

Statuses: session vs. transaction

The status of a session and the transaction_status of a payment attempt represent two different things:

  • Session status is the whole checkout — the order waiting to be paid. It starts as pending and can only end as completed or expired.
  • Transaction status is the result of the customer's latest attempt to pay. A customer can make several attempts in one session.

For order fulfillment, base your logic on the transaction status, not only on the session status. Before the first attempt, transaction_status is an empty string ("") on Direct API accounts, and Pending or "" on legacy accounts.

Session status

StatusDescription
pendingThe session is open. The URL is active and the customer can pay.
completedThe customer paid, or saved the card on an enrollment session. Final state.
expiredThe time limit was reached (at most 24 hours). The session can no longer be paid. Final state.

Transaction status

StatusDescription
PendingThe payment was initiated but is not yet confirmed (awaiting 3D Secure, a voucher or a transfer).
SuccessThe payment was authorized and processed.
DeclinedThe payment was declined. The customer may retry.
ExpiredThe attempt was not completed in time.

Key identifiers

IdentifierWhat it is
Session idIdentifies the session, e.g. cs_97_41528_42434d…. Use it with Get a session.
payment_idA number that identifies the payment of a payment session. It exists from creation, never changes, and stays the same when the customer retries with another card. Use it with Get a payment, for reconciliation and with support. 0 on enrollment sessions.
external_idYour own order reference, e.g. ORD-001 (generated for you if you do not send one). Also send it as metadata.external_id so it comes back in webhooks.
direct_transaction_idDirect API accounts only: the id of the customer's latest payment attempt (a UUID). It changes when the customer retries.
payment_flowdirect when your account is processed through the Direct API; not present otherwise. Fixed when the session is created.

One order (external_id) maps to one session and one payment_id, which can have several attempts.

Payment methods

Values for payment_method_types. A method is shown only when it is active for your business in the Dashboard and listed on the session.

ValueMethodType
cardCredit / debit cardCard
saved_cardsThe customer's saved cardsCard
apple_payApple Pay — on the v2 design, for Direct API accounts, on Apple devicesWallet
oxxopayOXXO PayCash voucher
speiSPEIBank transfer
mercadopagoMercado PagoExternal redirect
safetypayCashSafetyPay CashCash
safetypayTransferSafetyPay TransferBank transfer
neosurfNeosurfPrepaid voucher

Mercado Pago options

Sent in payment_method_config.mercadopago:

FieldTypeDescription
payment_methods.excluded_payment_methods[].idstringMethods to hide, e.g. master.
payment_methods.excluded_payment_types[].idstringMethod types to hide, e.g. ticket.
payment_methods.default_payment_method_idstringPreselected method.
payment_methods.installmentsnumberMaximum installments.
binary_modebooleanOnly approved or rejected, never pending.
statement_descriptorstringText on the card statement.
auto_returnstringWhen to return automatically: approved or all.

Redirect URLs

URLThe customer is sent there when…
success_urlthe payment succeeds.
pending_urlthe payment is pending (for example an OXXO voucher or a SPEI transfer).
cancel_urlthe customer cancels or the payment is declined at Mercado Pago.
return_urlno specific URL above applies. The only one used by enrollment sessions.

With redirect_on_completion: "always" (default) the checkout redirects automatically at the end. With "never" it does not redirect; your page decides what to do from the embedded events.

Error codes

HTTP statusCodeMeaning
400E004The request is invalid. metadata.errors has one entry per problem.
400E0014You asked for the payment of an enrollment session.
401 / 403—Missing or invalid API key, or a key from another environment.
404E003No session or payment with this id.
500E001Unexpected error. Retry with the same x-idempotency-key.

Environments

SandboxProduction
API base URLhttps://api-stage.tonder.iohttps://api.tonder.io
Checkout page originhttps://stage-payflow.tonder.iohttps://payflow.tonder.io
Dashboardhttps://dashboard-stage.tonder.iohttps://dashboard.tonder.io

Good to know

  • A session can be paid once and lasts at most 24 hours.
  • The amount, currency and line items of a session cannot be changed. Create a new session instead.
  • If the customer retries, the session reports only the latest attempt; payment_id never changes.
  • Test everything in Sandbox with your test API key before going live.

Next steps

Was this page helpful?

On this page