Guides
Automatic Pix (recurrences)
Create the recurrence with an immediate payment, let the player authorize it, schedule charges and handle cancellations.
In Automatic Pix the player authorizes, at their bank, recurring charges from the operator. A recurrence starts with an immediate payment: the player pays the QR Code and, in the same step, authorizes the next charges. Notifications go to the automaticDepositUrl.
1. Create the recurrence
curl --request POST \
--url https://okto.mimicr.dev/automatic/recurrences \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"taxId": "604.184.437-34",
"name": "Ana Ribeiro",
"amount": 2990,
"frequency": "MONTHLY",
"dateFirstRecurrence": "2026-10-26",
"totalRecurrences": 12,
"immediateTransaction": { "amount": 2990, "expirationInSeconds": 3600 },
"contract": { "id": "assinatura0001", "description": "Assinatura do clube" },
"descriptionToPayer": "Assinatura mensal do clube",
"externalId": "5c3d8382-ab14-4d30-b42b-bc806ecc69a7",
"tags": ["clube"]
}'The response is 201:
{
"id": "e7c925a5-c9a7-4144-b84f-a3d99cc13d97",
"externalId": "5c3d8382-ab14-4d30-b42b-bc806ecc69a7",
"bankingId": "RR30980539202610211dbfcf5ab19",
"status": "PENDING",
"subStatus": "AWAITING_FIRST_PAYMENT",
"frequency": "MONTHLY",
"totalRecurrences": 12,
"dateFirstRecurrence": "2026-10-26",
"dateLastRecurrence": "2027-09-26",
"expirationDate": "2026-10-21T20:09:06.914000+00:00",
"brcode": "00020101021226880014br.gov.bcb.pix2566qrcode.okto.mimicr.dev/v2/rec/e7c925a5-...",
"immediatePixTransaction": { "amount": 2990, "id": "…", "status": "pending" }
}| Field | Rule | Error |
|---|---|---|
taxId, name | Valid CPF and a name | 2001, 2009 |
frequency | WEEKLY, MONTHLY, QUARTERLY, BIANNUAL or ANNUAL | 4443 |
dateFirstRecurrence | yyyy-MM-dd, at least 2 days after today | 2004, 4505 |
totalRecurrences | Positive integer | 4443 |
descriptionToPayer | Required | 4442 |
immediateTransaction.amount | Required, in cents | 4506 |
immediateTransaction.expirationInSeconds | Default 3600 | 4443 |
contract.id | Up to 35 alphanumeric characters | 4443 |
externalId | UUID (generated if omitted) | 2010 |
See Create a recurrence.
2. The player pays and authorizes
The player scans the brcode at their bank. In the sandbox, play that role in one of these ways:
- The test endpoint Mock pay and authorize, with the exact
brcodeinpixChargeTextContent(anything else answers4446) and thepayerTaxId. - The test endpoint Mock QR payment: pays without authorizing (
subStatus: "FIRST_PAYMENT_SUCCESS", the recurrence staysPENDING). - The control API:
npx mimicr action okto player.step step=automatic:authorize id=<recurrence-id>(alsoautomatic:pay,automatic:rejectandautomatic:cancel).
curl --request POST \
--url https://okto.mimicr.dev/automatic/recurrences/e7c925a5-c9a7-4144-b84f-a3d99cc13d97/mock-pay-and-authorize \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"pixChargeTextContent": "<brcode>",
"payerTaxId": "60418443734"
}'The response is 200 with no body. Two notifications arrive: AutomaticPixDepositPayment (the immediate payment, paid) and AutomaticRecurrenceAuthorization (the recurrence, AUTHORIZED).
npx mimicr wait okto delivery transaction_id=e7c925a5-c9a7-4144-b84f-a3d99cc13d97 event=AUTHORIZED
Recurrence statuses
status | subStatus | When |
|---|---|---|
PENDING | AWAITING_FIRST_PAYMENT | Created, QR not paid yet |
PENDING | FIRST_PAYMENT_SUCCESS | QR paid, authorization pending |
AUTHORIZED | VALIDATION_SUCCEEDED | Paid and authorized |
REJECTED | VALIDATION_REJECTED_PAYER | The player refused; immediate payment failed with 4114 |
FAILED | FAILED | The payer was rejected by the test CPFs or by chaos |
EXPIRED | EXPIRED | expirationDate passed unpaid; immediate payment failed with 4108 |
CANCELLED | CANCELLED | The player cancelled at the bank |
CANCELLED | CANCELLATION_VALIDATION_SUCCESS | The operator cancelled |
Check it with Get a recurrence or Get recurrence status.
3. Scheduled charges
Once the recurrence is AUTHORIZED, charges are scheduled on the bank side. In the sandbox, use the test endpoint Mock a scheduled charge:
curl --request POST \
--url https://okto.mimicr.dev/automatic/recurrences/e7c925a5-c9a7-4144-b84f-a3d99cc13d97/mock-scheduling \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"payer": { "taxId": "60418443734", "ispb": "30980539", "accountNumber": "123456789", "name": "Ana Ribeiro" },
"dueDate": "2026-10-21"
}'payer.taxId,payer.ispbandpayer.accountNumberare required (4442).dueDatedefaults to today; a charge due today or earlier settles right away, a future one settles on its day (move the clock withnpx mimicr clock okto +5d).amountdefaults to the recurrence amount."isRejected": truecreates the charge already refused (4454).- At most
totalRecurrencesscheduled charges (4520).
Each charge is a transaction with its own id, notified as AutomaticPixDepositPayment. List them with List recurrence transactions and check one with Get transaction status.
Cancellations
| Who | How | Outcome |
|---|---|---|
| Operator, the recurrence | Cancel a recurrence with reason RECEIVER_OR_PARTICIPANT_REQUEST_ERROR or RECEIVER_PARTICIPANT_CONFIRMED_ELSEWHERE | 204; pending charges failed with 4501 |
| Operator, one charge | Cancel a scheduled transaction with reason MERCHANT_REQUESTED or OTHER_REASONS | 204; only scheduled charges not settled yet (4140 otherwise) |
| Player, the recurrence | Mock cancellation by the payer or step=automatic:cancel | CANCELLED / CANCELLED |
| Player, the scheduling | Mock scheduling cancellation | The pending charge becomes failed with 4501 |
Only PENDING or AUTHORIZED recurrences can be cancelled; otherwise the answer is 400 with 1000. An unknown recurrence answers 4502.
Notifications
{
"AutomaticRecurrenceAuthorization": {
"id": "e7c925a5-c9a7-4144-b84f-a3d99cc13d97",
"bankingId": "RR30980539202610211dbfcf5ab19",
"externalId": "5c3d8382-ab14-4d30-b42b-bc806ecc69a7",
"status": "AUTHORIZED",
"detailedStatus": "VALIDATION_SUCCEEDED",
"immediatePixTransaction": { "amount": 2990, "id": "…" },
"recurrence": { "id": "e7c925a5-c9a7-4144-b84f-a3d99cc13d97", "status": "AUTHORIZED", "statusDetailed": "VALIDATION_SUCCEEDED" }
}
}AutomaticPixDepositPayment carries id, amount, status (paid or failed), errorList, recurrence and, when paid, transactionInfo. See Notifications.
The mock-* endpoints exist in Okto's demo environment and are never hit by chaos in Mimicr. Settling on the due date and the cap of scheduled charges at totalRecurrences are Mimicr's own choices.