Skip to main content
With Pix Automático, the payer authorizes the recurring debit once, in their bank app, by scanning a QR code. From then on, the payer’s bank debits each cycle and Pagou tells you the outcome through subscription webhooks.

How it works

  1. Create the customer with POST /v2/customers, including a CPF or CNPJ.
  2. Create the subscription with payment_method: "pix_automatic". No card token is involved.
  3. Show authorization.qr_code to the payer.
  4. The payer authorizes the recurring debit in their bank app.
  5. The payer’s bank debits each cycle. Listen to subscription webhooks to follow authorizations, payments, failures, and cancellation.
What changes compared to card subscriptions:

Prerequisites

  • Subscriptions must be enabled for your account (403 otherwise), and so must Pix Automático (422 otherwise). See Errors.
  • The customer must exist in /v2/customers with a CPF or CNPJ in document. Address and phone are optional.
  • currency must be BRL.

Create a subscription without a trial

Without trial_end, the same QR code authorizes the recurring debit and pays the first cycle.
Response 201:
The subscription stays incomplete until the payer authorizes and the first debit is paid. At that point it becomes active and you receive subscription.started with previous_status: "incomplete". This flow does not send subscription.created.

Create a subscription with a trial

Send trial_end (ISO 8601, in the future) and the QR code only authorizes the recurring debit. Nothing is charged until the trial ends. Trials depend on your account configuration. When they are not available, the request returns 422 with PIX_AUTOMATIC_TRIAL_NOT_SUPPORTED and nothing is created. Where trials are available, also send billing_day_of_month. The first debit is scheduled for the first occurrence of that day on or after the signup date, and that date must fall on or after trial_end and at least 3 full days (72 hours) after the moment of signup. Without billing_day_of_month, the billing day is the signup day, so the first debit would fall before the trial ends and the request is rejected. When the dates do not fit, the request returns 422 with PIX_AUTHORIZATION_FAILED and a detail that explains why. In this example the subscription is created on September 23, with trial_end on October 7 and billing_day_of_month: 10, so the first debit is scheduled for October 10:
Response 201:
When the payer approves the authorization, the subscription becomes trialing and you receive subscription.created (with latest_transaction: null). Three days before trial_end you receive subscription.trial_will_end, if the subscription is already trialing by then. The first debit after the trial makes it active and sends subscription.started.

Request fields

Billing intervals

Any other combination, or one your account does not support, returns 422 with PIX_AUTHORIZATION_FAILED and a detail that says the interval is not supported.

Show the QR code

The authorization block is what the payer needs: GET /v2/subscriptions/{id} returns authorization only while the authorization is pending. After the payer approves or rejects it, the block disappears. If the payer never authorizes, what happens depends on your account configuration: the subscription either stays incomplete, or is canceled when the code expires and you receive subscription.canceled. To stop waiting, cancel it yourself (see Cancel). recurringAuthorization.status tells you where the authorization stands: pending, approved, rejected, cancel_pending, or canceled. On GET by id, recurringAuthorization.lastDebit shows the most recent debit attempt.

What to store

  • subscription id
  • customer id
  • current status
  • authorization.qr_code, while the authorization is pending
  • recurringAuthorization.status
  • latest_transaction.id from the webhooks, when present

Status and webhooks

Things to know when you handle these events:
  • Pix Automático charges are reported only through subscription.* events. You do not receive transaction.* webhooks for them.
  • latest_transaction.method is "pix". The payload does not say which payment method the subscription uses, so identify Pix Automático subscriptions by the id you stored, or read paymentMethod with GET /v2/subscriptions/{id}.
  • failure_reason is informative. Do not build logic on specific values.

Failed debits

The payer’s bank may try a debit more than once. Those intermediate attempts do not generate events. When no attempts are left, you receive subscription.payment_failed with attempt_number and failure_reason.
  • If it was the first debit of a subscription without a trial, the subscription stays incomplete.
  • Otherwise (the first debit after a trial, or a later cycle), with failure_policy: retry_then_cancel the subscription becomes past_due and you receive subscription.past_due. For a later cycle, a debit paid afterwards makes it active again and sends subscription.renewed.
  • A failed debit does not create a new transaction. On subscription.payment_failed and subscription.past_due, latest_transaction is the most recent transaction of the subscription, which is usually the previous paid cycle.
  • retry_offsets_days is accepted but has no effect: retry timing follows the Pix Automático rules and cannot be configured.
  • Anything else failure_policy does for Pix Automático depends on your account configuration. subscription.canceled is the only confirmation that a subscription ended.

Cancel

POST /v2/subscriptions/{id}/cancel works while the subscription is incomplete, trialing, active, or past_due. For Pix Automático the cancellation is immediate: it is never scheduled for the end of the period, the status never becomes cancel_scheduled, and the webhook is subscription.canceled, not subscription.updated. The response comes in one of two forms, depending on your account configuration:
  • Already canceled: status is canceled and recurringAuthorization.status is canceled.
  • Waiting for confirmation: status keeps its current value and recurringAuthorization.status is cancel_pending. The subscription becomes canceled once the cancellation is confirmed, and you receive subscription.canceled then.
In both cases, treat subscription.canceled as the source of truth. Repeating the call on a subscription that is canceled, or whose cancellation is waiting for confirmation, returns 200 with no change. Two concurrent calls on the same subscription may return 409 with SUBSCRIPTION_CANCEL_IN_PROGRESS; retry after a short wait.

Limitations

  • Plan changes are not available. PATCH /v2/subscriptions/{id} with product_id returns 422 and the plan stays the same: PLAN_CHANGE_UNAVAILABLE_FOR_PAYMENT_METHOD when the subscription is tied to a catalog plan, or SUBSCRIPTION_HAS_NO_CATALOG_PLAN / PRODUCT_NOT_FOUND when it is not. To move the payer to another plan, cancel the subscription and create a new one, which needs a new authorization.
  • Billing intervals are limited to the table in Request fields.
  • Trials depend on your account configuration.
  • Retry spacing cannot be configured: retry_offsets_days is ignored.
  • The debit date is not guaranteed. Follow the webhooks instead of expecting a charge on a fixed day.

Errors

When Pix Automático is not enabled or not configured, contact support to enable it for your account.

Sandbox

In the sandbox (https://api.sandbox.pagou.ai) there is no payer’s bank on the other side: nobody scans the QR code and nothing is debited on its own. You play the payer’s bank with POST /v2/subscriptions/{id}/simulate. The subscription moves exactly as it would in production and you receive the same webhooks. Create the customer and the subscription as described above, with your sandbox token. Then send one event per call:
The response is 200 with the updated subscription, in the same shape as GET /v2/subscriptions/{id}. After fail, with failure_policy: retry_then_cancel the subscription becomes past_due and you receive subscription.past_due; for a later cycle, a pay makes it active again with subscription.renewed. With immediate_cancel it becomes canceled and you receive subscription.canceled. With a trial, a fail before the first debit is paid leaves the subscription past_due and no pay recovers it: cancel it and create a new one to keep testing. What to know about the sandbox:
  • One call is one event. Each pay pays one cycle right away, whatever the billing interval.
  • The subscription moves only when you call the endpoint. Do not rely on time-based events such as subscription.trial_will_end in the sandbox.
  • An event that does not fit the current authorization or status returns 409 with SUBSCRIPTION_SIMULATION_NOT_APPLICABLE and changes nothing: for example, pay before authorize, or authorize twice.
  • authorization.qr_code has the Pix format, but it does not set up a real recurring authorization: do not scan it with a bank app, use authorize instead. expires_at is null and the authorization never expires on its own: use reject to test a refused authorization.
  • The sandbox accepts trial_end without checking it against billing_day_of_month, and the first debit happens when you send pay. In production, trials depend on your account configuration and the dates must fit (see Create a subscription with a trial).
  • Billing intervals are week × 1 and month × 1, 6, or 12. month × 3 is refused, and so is an amount below 100.
  • A cancellation responds already canceled.
  • Do not use PUT /v2/transactions/{id} on a Pix Automático charge: it changes the transaction but not the subscription.
  • The Pix values in Test Data (documents and the 7300 amount) do not apply to Pix Automático.
  • The route exists only in the sandbox. In production it returns 404.