/sessions

Creates a payment session on the best gateway for the method and currency (or the one pinned with gateway) and returns where to send the customer.

Server URLhttps://pay.contagorda.com/api/v1
POST/sessions

Authorization

Bearer token: an app key from Apps (sk_app_live_… or sk_app_test_…), or the tenant key from Settings (sk_live_… or sk_test_…). The key picks the mode: a live key only sees live data, a test key only sandbox data.

Parameters

Idempotency-Keystring · headerrequired

Any unique string per operation (an order id works). The same key returns the first result instead of creating another.

Request Body

application/json, required

amountstringrequired

Positive, at most 2 decimal places, e.g. "49.90".

currencystringrequired
One of BRL, USD, EUR
methodstringrequired
One of card, pix, boleto
localestringoptional

Language of the payment page and the gateway checkout. Also takes pt, en-US and similar. Without it the app's Checkout language applies, else the customer's browser.

One of en, pt-BR
return_tostringrequired

Where the customer comes back, with session_id and a signed pay_token.

Format uri
gatewaystringoptional

Pins one gateway configuration; without it the router picks by method and currency.

Format uuid
metadataobjectoptional

Your own keys, returned as sent.

customerobjectoptional

Found by external_ref, created when new; the contact fields are kept up to date.

external_refstringrequired

Your own user id.

emailstringoptional
Format email
namestringoptional
documentstringoptional

CPF, CNPJ or tax id.

phonestringoptional
address_line1stringoptional
address_line2stringoptional
address_numberstringoptional
neighborhoodstringoptional
citystringoptional
statestringoptional

Two letters, e.g. SP.

zipcodestringoptional
countrystringoptional

Two letters, e.g. BR.

Response Body

201Session created.
idstringoptional
Format uuid
statusstringoptional
One of pending, processing, paid, failed, expired, refunded
amountstringoptional
currencystringoptional
methodstringoptional
gatewayobjectoptional

The configuration that handles the payment.

idstringoptional
Format uuid
namestringoptional
providerstringoptional
One of stripe, asaas, abacatepay, pagarme, cielo
sandboxbooleanoptional
redirect_urlstringoptional

Send the customer here to pay.

Format uri
duplicatebooleanoptional

true when the Idempotency-Key was already used.

created_atstringoptional
Format date-time
200Same Idempotency-Key as an earlier call; the first session comes back with `duplicate: true`.
idstringoptional
Format uuid
statusstringoptional
One of pending, processing, paid, failed, expired, refunded
amountstringoptional
currencystringoptional
methodstringoptional
gatewayobjectoptional

The configuration that handles the payment.

idstringoptional
Format uuid
namestringoptional
providerstringoptional
One of stripe, asaas, abacatepay, pagarme, cielo
sandboxbooleanoptional
redirect_urlstringoptional

Send the customer here to pay.

Format uri
duplicatebooleanoptional

true when the Idempotency-Key was already used.

created_atstringoptional
Format date-time
401Missing or invalid secret key.
errorstringoptional

What went wrong.

422Missing Idempotency-Key, no gateway for the method and currency, an invalid amount or an invalid record.
errorsobjectoptional

One message per field (idempotency_key, gateway, amount, replaces, subscription or record).

502The gateway refused or failed the call.
errorsobjectoptional
gatewaystringoptional

The gateway's message.

providerstringoptional

The provider that failed.

Are you sure?

Keyboard shortcuts

⌘ KSearch and navigate⌘ JOpen and close the Workbenchg hHomeg pPaymentsg cCustomersg sSubscriptionsg aAppsg gGateways?This listEscClose