Skip to main content
Pix Automático lets you charge your customers on a recurring basis (subscriptions, monthly fees, services) without the payer authorizing each charge. The customer authorizes the recurrence once, in their own bank’s application, and from then on each charge is debited automatically on the agreed date, within the limits that were authorized. This guide covers the full cycle: creating the recurrence, managing collections, cancelling, reading the objects back and the webhooks fired at each step.

Concepts

On Trio, Pix Automático is made of three chained objects:
  • Recurrence (recurrence): the authorization contract between you and the payer. It defines periodicity, amount (fixed or variable), dates and retry rules.
  • Collection (collection): each charge generated from the recurrence, for example October’s monthly fee.
  • Attempt (attempt): each try to settle a collection. The same collection can have more than one attempt, according to the retry policy.
All examples use the sandbox base URL https://api.sandbox.trio.com.br. In production, switch the base URL to https://api.trio.com.br.

Endpoints

Create a recurrence

Send a POST to Create recurrence. The fields below apply to every journey; the journey variations come next.
start_date must be at least 3 days after the current date. Possible values of periodicity:

Fixed and variable amounts

The amounts block defines how the amount of each collection is determined:
  • Fixed amount: send amounts.fixed in cents (BRL 100.00 = 10000). Every collection has this amount and you cannot change it before it is sent.
  • Variable amount with a minimum: send amounts.minimum in cents. The payer cannot authorize a limit lower than the minimum, and you must inform the amount of each collection before its collection date.
  • Variable amount with no minimum: omit amounts. You must also inform the amount before each collection.
On variable-amount recurrences, informing the amount before the collection is sent is mandatory. Either update the amount of the collection or send amount when you schedule it.

Authorization journeys

Pix Automático defines different authorization journeys. On Trio, the journey results from the combination of three parameters:
  • options.authorization_type: qrcode generates a QR code for the payer to authorize; app sends the authorization request straight to the payer’s bank application.
  • first_payment: present or absent, defines whether a first payment is combined with the authorization.
  • first_payment.recurrence_required: true approves the recurrence and the first payment in a single authorization; false lets the payer pay the first payment and still refuse the recurrence.
The reference.type field in the response indicates the channel used: qrdn (dynamic QR code), qres (static QR code) or requ (request sent to the application). The four journeys below are the ones our customers use most.

Journey A: QR code, fixed amount, no first payment

The customer scans a QR code and authorizes the recurrence. No charge happens at authorization time.

Journey B: QR code with a first payment

The payer approves the recurrence and the first charge in a single action. Use it when the subscription starts with an immediate charge. due_detail configures the due date, interest, fine and discounts of the first payment.
Every rule inside due_detail carries a calculation_type: with amount, send amount in cents; with percentage, send value in basis points (100 = 1%). Only due_date is required. These are the same payment rules a boleto uses; the Create a boleto guide explains them in detail. With recurrence_required: false, the payer can pay the first payment and still refuse the recurrence; with true, both are approved together in a single authorization.

Journey C: request sent to the payer’s app

Instead of generating a QR code, Trio sends the authorization request directly to the payer’s bank application. counterparty.bank_account is required: it is the account that receives the approval request.
When the authorization goes through the application, Trio creates an authorization request (recurrence request). Follow it with load_requests when you read the recurrence, or with GET /v2/in/pix/recurrences/requests/{id}. The request carries the recurrence.id it belongs to, the counterparty it was sent to and expires_at, the moment after which the payer can no longer answer it. Its statuses are created, sent, received, rejected, accepted, expired and cancelled.

Journey D: variable amount with a minimum

For subscriptions whose amount changes every cycle (consumption, usage, variable installments), send only the minimum. You must inform the amount of each collection before it is sent.

Response

On success you receive 201 Created with the recurrence object. id is the recurrence identifier on Trio. For QR code journeys, the qrcode block carries the hash (the BR code, the Pix copy-and-paste code) and the id of the QR code; it is null when the journey has no QR code. Amounts come back as money objects ({ "amount", "currency" }), the settings are grouped under options, the payer under counterparty and the authorization channel under reference.
Offer the hash to the payer as copy and paste, or render the QR code image from it. The recurrence only takes effect after the payer authorizes it, when authorized_at is filled in. Follow that through the recurrence.approved webhook, or recurrence.rejected and recurrence.expired.

Options

The options block defines how the recurrence behaves over time. All fields are optional and have default values.

Automatic and manual collection management

With automatic_schedule: true (the default), Trio creates and schedules each collection at the defined periodicity. You do nothing each cycle, just react to the webhooks. Use this mode when the amount is fixed or you can determine it in advance. With automatic_schedule: false (manual management), you create and schedule each collection every cycle. Use this mode when, for example, the variable amount is only known close to the collection date. See Manage collections.

Retries and non-payment

retry_policy defines what happens when a collection is not settled, and automated_attempt_retry defines who runs the retries: with true, Trio creates and manages them; with false, your application does.
  • 3r_7d: the collection is retried 3 times over 7 days, on alternating days. Each retry generates a new attempt. If no attempt is settled, the collection moves to a final failure or expiration status.
  • none: no retries. A failed attempt ends the collection.
The retry policy works at the collection level, not the recurrence level. If your business rule is to end the subscription after an unpaid collection, monitor the attempt events (recurrence_collection_attempt with type failed or expired) or the collection events (recurrence_collection with type expired or rejected). When you detect that the retries are exhausted, cancel the recurrence to implement automatic cancellation for non-payment.

Manage collections

Each collection is one debit occurrence of the recurrence. A collection goes through the statuses created, active, settled, expired, rejected and cancelled. Its attempts go through requested, scheduled, settled, cancelled, rejected, expired and failed.

Create the next collection

With automatic_schedule: false, create the next collection of the recurrence with Create next collection. recurrence_id (required) is the recurrence the collection belongs to.
The 201 Created response brings the collection with its stages and attempts. The collection points to its recurrence through recurrence.id, and each stage records a status change, with error_code and error_message when there is a rejection reason.

Schedule a collection

Once created, schedule the collection so Trio sends it to the payer’s bank. Scheduling must happen between 2 and 10 days before the cycle’s payment date. Call Schedule collection:
The success response is 204 No Content. Follow the result through the recurrence_collection_attempt event with type scheduled and, later, settled or failed.

Update the amount of a collection

On variable-amount recurrences, you can update the amount of a collection that has not yet been sent to the payer’s bank with Update collection amount:
amount is the new amount in cents. The update is only possible while the collection has not been sent; on fixed-amount recurrences the amount cannot be changed. The success response is 204 No Content. Read the collection back with GET /v2/in/pix/recurrences/collections/{id} to confirm the new amount.

Cancel a collection

Cancel one collection, without cancelling the whole recurrence, with Cancel collection:
The success response is 204 No Content. The collection moves to cancelled, you receive the recurrence_collection.cancelled event and can confirm it with a GET. The next collections of the recurrence continue normally.

Cancel a recurrence

To end the recurrence completely, so that no future collection is generated, call Cancel recurrence:
requester_tax_number (required) is the CPF or CNPJ of whoever requests the cancellation. The success response is 204 No Content. The recurrence moves to cancelled and you receive the recurrence.cancelled event.

Read recurrences, collections and attempts

The GET endpoints return the current state of each object. Listings are paginated with limit, before and after; see Pagination.

Get a recurrence

Call Get recurrence:

List recurrences

Call List recurrences:

Get an authorization request

Call Get authorization request. load_stages includes the request’s stages; entity_id, group_id and bank_account_id are optional filters.

Get a collection

Call Get collection to read one collection with its stages and attempts:

List collections

Call List collections to list the collections of a recurrence:

List attempts

Call List attempts to list the attempts of a collection:

Get an attempt

Call Get attempt. load_stages includes the attempt’s stages; entity_id is an optional filter.
Each attempt carries the collection.id it charges, its due_date, the Pix end_to_end_id and the transaction_date once it is paid.

Webhooks

Trio notifies each step asynchronously through webhooks. Three event categories relate to Pix Automático; the Events catalog describes the payload structure.

Recurrence events

Category recurrence, fired on the state changes of the recurrence (the authorization contract). Payload example

Collection events

Category recurrence_collection, fired on the state changes of each collection. Payload example

Attempt events

Category recurrence_collection_attempt, fired on each attempt to settle a collection. This is where you follow the actual result of the debit and the retries. Payload example

End-to-end summary

The table ties each step of the process to the corresponding endpoint and webhook.
Handle the final states (settled, failed, expired, cancelled) through webhooks and use the GET endpoints for reconciliation. For non-payment, combine attempt monitoring with the retry_policy and decide, in your application, whether to cancel the recurrence.

Next steps