/subscriptions

Creates a subscription and its first checkout. Send the customer to redirect_url; activation, renewals and cancellation arrive as webhooks. replaces cancels an older subscription of the same customer once this one is active (plan change).

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

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

Price per interval, e.g. "29.90".

currencystringrequired
One of BRL, USD, EUR
intervalstringrequired
One of month, year
descriptionstringoptional

Shown on the checkout and the invoices.

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
Format uri
gatewaystringoptional

Pins one gateway configuration that supports subscriptions.

Format uuid
replacesstringoptional

A subscription of the same customer to cancel once this one is active.

Format uuid
metadataobjectoptional
customerobjectrequired

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

201Subscription created, waiting for the first payment.
idstringoptional
Format uuid
statusstringoptional

pending: waiting for the first payment; active: grants access (also while a cancellation is scheduled); past_due: a renewal failed and the gateway is retrying; canceled: ended.

One of pending, active, past_due, canceled
amountstringoptional

Price per interval, decimal with a dot.

currencystringoptional
intervalstringoptional
One of month, year
descriptionstring | nulloptional
gatewayobjectoptional

The configuration that handles the payment.

idstringoptional
Format uuid
namestringoptional
providerstringoptional
One of stripe, asaas, abacatepay, pagarme, cielo
sandboxbooleanoptional
customerobject | nulloptional
idstringoptional
Format uuid
external_refstringoptional

Your own id for the customer, as sent to /connect.

emailstring | nulloptional
namestring | nulloptional
documentstring | nulloptional
phonestring | nulloptional
address_line1string | nulloptional
address_line2string | nulloptional
address_numberstring | nulloptional
neighborhoodstring | nulloptional
citystring | nulloptional
statestring | nulloptional
zipcodestring | nulloptional
countrystring | nulloptional
metadataobjectoptional

What the product sent with the checkout, echoed back on the subscription and on every renewal cycle.

current_period_endstring | nulloptional

End of the paid period, when the next renewal is charged. Can be null in subscription.activated; the date then arrives in subscription.updated.

Format date-time
cancel_at_period_endbooleanoptional

true once a cancellation is scheduled for the end of the period.

cancel_requested_atstring | nulloptional

When the cancellation was asked for.

Format date-time
cancel_atstring | nulloptional

When a scheduled cancellation ends it.

Format date-time
replacesstring | nulloptional

The subscription this one replaced (a plan change).

Format uuid
canceled_atstring | nulloptional

When it ended.

Format date-time
created_atstringoptional
Format date-time
linksobjectoptional
selfstringoptional
Format uri
session_idstringoptional

The session of the first payment.

Format uuid
redirect_urlstringoptional

Send the customer here to subscribe.

Format uri
duplicatebooleanoptional
200Same Idempotency-Key as an earlier call; the first subscription comes back with `duplicate: true`.
idstringoptional
Format uuid
statusstringoptional

pending: waiting for the first payment; active: grants access (also while a cancellation is scheduled); past_due: a renewal failed and the gateway is retrying; canceled: ended.

One of pending, active, past_due, canceled
amountstringoptional

Price per interval, decimal with a dot.

currencystringoptional
intervalstringoptional
One of month, year
descriptionstring | nulloptional
gatewayobjectoptional

The configuration that handles the payment.

idstringoptional
Format uuid
namestringoptional
providerstringoptional
One of stripe, asaas, abacatepay, pagarme, cielo
sandboxbooleanoptional
customerobject | nulloptional
idstringoptional
Format uuid
external_refstringoptional

Your own id for the customer, as sent to /connect.

emailstring | nulloptional
namestring | nulloptional
documentstring | nulloptional
phonestring | nulloptional
address_line1string | nulloptional
address_line2string | nulloptional
address_numberstring | nulloptional
neighborhoodstring | nulloptional
citystring | nulloptional
statestring | nulloptional
zipcodestring | nulloptional
countrystring | nulloptional
metadataobjectoptional

What the product sent with the checkout, echoed back on the subscription and on every renewal cycle.

current_period_endstring | nulloptional

End of the paid period, when the next renewal is charged. Can be null in subscription.activated; the date then arrives in subscription.updated.

Format date-time
cancel_at_period_endbooleanoptional

true once a cancellation is scheduled for the end of the period.

cancel_requested_atstring | nulloptional

When the cancellation was asked for.

Format date-time
cancel_atstring | nulloptional

When a scheduled cancellation ends it.

Format date-time
replacesstring | nulloptional

The subscription this one replaced (a plan change).

Format uuid
canceled_atstring | nulloptional

When it ended.

Format date-time
created_atstringoptional
Format date-time
linksobjectoptional
selfstringoptional
Format uri
session_idstringoptional

The session of the first payment.

Format uuid
redirect_urlstringoptional

Send the customer here to subscribe.

Format uri
duplicatebooleanoptional
401Missing or invalid secret key.
errorstringoptional

What went wrong.

422Missing Idempotency-Key, no gateway with subscriptions for the currency, an invalid amount, an invalid `replaces` 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