Flow
Step 1: Create the authorization
The response is
201 Created: the authorization, status CREATED, with the paymentUrl and every charge in schedules — the first payment (isFirstPayment: true) and each recurring charge, all CREATED:
schedule.startDate is two days before the schedule.startDate you sent — or the day after the first payment, when that is later — and schedule.endDate the day after the one you sent. Redirect the customer to paymentUrl to approve the authorization in their bank.
Reference: POST .../wallets/{walletId}/pix-billing-automatic
Step 2: Follow the authorization lifecycle
ThePIX_BILLING_AUTOMATIC_* events track the authorization itself (the consent the customer approves):
When the customer revokes the authorization in their bank, it moves to
REVOKED and its pending charges are canceled; that change has no webhook, so read the authorization back.
GET .../pix-billing-automatic/{pixBillingAutomaticId}.
Step 3: Follow each charge
ThePIX_BILLING_AUTOMATIC_SCHEDULE_* events track the individual charges:
attempts — unless the refusal is final (for example, the customer’s limit for the period was reached). Then the charge becomes FAILED. A charge the customer’s bank refuses to schedule has no webhook: it ends as SCHEDULE_ERROR, or stays CREATED past its date with no external.scheduleId and a SCHEDULE_ATTEMPT_FAILED event in its history. If you rely on webhooks, also check the wallet’s charges for status=SCHEDULE_ERROR (treat it like FAILED) and for status=CREATED with a past maxDueDate. Such a CREATED charge was most likely refused — but in rare cases the customer’s bank accepted it and the confirmation was lost, so confirm with Portão 3 support before charging it another way. A charge CREATED past its date that does carry external.scheduleId is still being processed by the customer’s bank: wait for its outcome — don’t charge it another way. To see what is due and what was paid across all the wallet’s authorizations, use GET .../wallets/{walletId}/pix-billing-automatic/schedules, filtered by status and due date. The events of an authorization — its creation and cancellations, each update from the customer’s bank, with its error — are in GET .../pix-billing-automatic/{pixBillingAutomaticId}/history.
Change a charge’s amount
Adjust an individual charge (for example, a partial charge) by updating it, referencing both the authorization ID and the charge ID:amount (centavos) must stay within the authorization’s minAmount/maxAmount range, so plan a variable range when you create the authorization if you’ll need it. Only a recurring charge that hasn’t been sent to the customer’s bank yet (CREATED) can change; the first payment can’t, it goes with the authorization.
Reference: PUT .../pix-billing-automatic/{pixBillingAutomaticId}/schedules/{pixBillingAutomaticScheduleId}. To list and filter authorizations, use GET .../wallets/{walletId}/pix-billing-automatic.
Cancel
- One charge —
POST .../schedules/{pixBillingAutomaticScheduleId}/cancelcancels it and keeps the authorization and its other charges. The first payment can’t be canceled on its own before the customer approves: cancel the whole authorization instead. - The whole authorization —
POST .../pix-billing-automatic/{pixBillingAutomaticId}/cancelstops it: no further charge is made, and its charges stillCREATEDorSCHEDULEDare canceled.
204 No Content.
Fall back to boleto on repeated failure
When charges keep failing (FAILED or SCHEDULE_ERROR), issue a boleto for the same amount so the customer can still pay:
CREATED, with the digitableLine and barcode to present to the customer — or download its PDF with GET .../boleto-billing/{boletoId}/download/pdf. Rarely it comes back INITIATED, without them yet: read it back until it is CREATED. There is no webhook for a boleto charge, so read it back with GET .../boleto-billing/{boletoId} to know when it is PAID. You can also add discount, fine, and interest rules (txnDiscountAmount, txnFineAmount, txnInterestAmount) — see Charge with a boleto and the endpoint reference for the full body.
Reference: POST .../wallets/{walletId}/boleto-billing
Next steps
Receive webhooks
Delivery envelope and the full event catalog.
Charge with PIX
One-off PIX charges with a QR Code.