/connect
Creates a one-off payment or a subscription for the calling app, on the gateway its routes pick (with automatic fallback), and returns where to send the customer.
The app's Charges setting decides what is created:
- a payments app creates a one-off payment;
- a subscriptions app creates a subscription, and
amount,currencyandintervalare required.
Two ways to call it:
- From the product's backend (recommended): JSON with
Authorization: Bearer. The answer carriesredirect_url. - From the customer's browser (apps on the API + signed forms flow): a signed form,
application/x-www-form-urlencoded, with the app's public key, the charge,expiresandsignature, and no Authorization header. The broker answers 303 to the checkout.
When it refuses a signed form, the customer sees an HTML page with a way back:
- 400:
expiresmissing or invalid; - 403: wrong signature or app;
- 410: expired;
- 422:
return_tonot allowed.
The signature is the lowercase hex HMAC-SHA256, keyed with the app's secret key, of every other field:
- flattened as
customer[email]; - sorted by key, byte by byte;
- percent-encoded per RFC 3986 (space as
%20); - joined as
key=valuewith&.
It is also the idempotency key. See the Signed checkout forms guide.
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
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
Decimal with a dot.
One-off payments only. Without it, card, or the gateway's method when it has no card (PIX on AbacatePay).
Subscriptions only (required there).
Subscriptions only, shown on the checkout.
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.
Must be an allowed return host of the app (any host while the list is empty).
Subscriptions only; the customer's running subscription to cancel once this one is active.
Found by external_ref, created when new; the contact fields are kept up to date.
Your own user id.
CPF, CNPJ or tax id.
Two letters, e.g. SP.
Two letters, e.g. BR.
Response Body
303Signed form only. Redirect to the gateway's checkout; a refusal answers an HTML page with a way back.
No body.
201Payment or subscription created.
The session id (payment) or the subscription id.
200Same Idempotency-Key as an earlier call; the first result comes back.
The session id (payment) or the subscription id.
401Missing or invalid secret key.
What went wrong.
403The app is paused, the `app` asked for does not exist, or the endpoint needs the tenant key.
What went wrong.
422Missing Idempotency-Key, a field of the other kind of charge (interval or replaces on a payments app, method on a subscriptions app), no route for the method and currency, an invalid amount or an invalid record.
One message per field (idempotency_key, gateway, amount, replaces, subscription or record).
502The gateway refused or failed the call.
The gateway's message.
The provider that failed.