Guides
Pix ITP
Charge through payment initiation by redirecting the customer to their bank and getting them back on your redirectUrl.
With Pix-ITP you don't show a QR Code: the deposit's reference is the ITP URL, where you redirect the customer. They authorize the payment in their bank and come back to the redirectUrl you provided.
Create the intent
curl --request POST \
--url https://pay4fun.mimicr.dev/deposit/api/v1/intents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"externalId": "deposito-itp-1",
"webhookUrl": "https://seu-servidor.example.com/webhooks/deposit",
"deposits": [
{
"method": "Pix-ITP",
"amount": 100.00,
"data": { "document": "39053344705", "redirectUrl": "https://sua-app.dev/retorno" }
}
]
}'data.document (a valid CPF/CNPJ of who will pay) and data.redirectUrl are required. Without them the response is 400 with DEP-044 and DEP-045 in Mimicr.
{
"externalId": "deposito-itp-1",
"id": "8d0c5f8e-...",
"status": "Pending",
"deposits": [
{ "id": "1f6b2c3d-...", "method": "Pix-ITP", "reference": "https://pay4fun.mimicr.dev/itp/1f6b2c3d-...", "amount": 100, "status": "Pending" }
]
}Redirect the customer
Send the customer to deposits[].reference. In Mimicr that URL opens a page that plays the payer's bank, with Autorizar (authorize) and Recusar (refuse) buttons.
- Authorize: the holder of
data.documentpays. The intent becomesReleasedand theSuccesswebhook arrives. - Refuse: the deposit becomes
Rejectedwith errorUSER_CANCELLEDand theRejectedwebhook arrives.
Then the page redirects (303) to the redirectUrl with ?id={intentId}&externalId=...&status=success|failed|cancelled. Those parameters are Mimicr's; Pay4Fun doesn't document the return. Don't rely on them to release the order: confirm with Get a deposit intent or the webhook.
Pay through the control API
With ITP the payer must be the holder of data.document: the PDF only requires the document, and Mimicr takes it that the payment is initiated from that holder's account. Without payer or document, the action uses that holder (the test payer with the same CPF, if there is one):
npx mimicr action pay4fun deposit.pay intentId=deposito-itp-1
In the example Davi pays, because 39053344705 is his CPF. payer=davi or document=39053344705 give the same result. A payer with another document answers 422 action_failed.
Deposit details
In Get a deposit, pixDetails has type: "ITP", document and redirectUrl. ITP doesn't expire on its own; cancel the intent with Cancel an intent if the customer gives up.