Guides
Sandbox control
Mimicr's control API, CLI and MCP to play the payer, the bank, the SPI and the back office, wait for events, move the clock and inject failures.
The GO 2.0 API only lets you act as the merchant. To test end to end, Mimicr also lets you act as the other side: the payer, their bank, the SPI and Pay4Fun's back office. All of it lives in the control API, at https://api.mimicr.dev/v1/pay4fun, and the same commands exist in the console, the CLI and the MCP server.
Authentication
Use an organization API key (mk_…), created in the organization settings, "Chaves de API" tab. Read keys only query; actions, clock, chaos, homologation and reset need a write key.
curl --url https://api.mimicr.dev/v1/pay4fun \ --header 'Authorization: Bearer mk_...'
With the CLI (Node 18+):
npx mimicr login mk_... npx mimicr status pay4fun
The key can also come from --key or the MIMICR_API_KEY variable. Output is JSON and the exit code is 1 on an HTTP error.
Routes
| Method and path | Purpose |
|---|---|
GET /v1/pay4fun | State: host, credentials, merchant and Pix key, balances of both accounts (in cents), homologation, chaos and clock; {"active": false} if not activated |
POST /v1/pay4fun/activate | Activates the organization's sandbox (201); if already active, 409 pay4fun_already_active |
POST /v1/pay4fun/reset | Deletes intents, keys, requests, contacts and webhooks; keeps credentials and configuration and sets the clock back to real time |
POST /v1/pay4fun/sweep | Runs the due steps now (payments, expirations, refunds, keys) and the webhook retries |
GET /v1/pay4fun/wait | Waits until an object or a notification shows up (long poll) |
GET /v1/pay4fun/clock | Sandbox time and offset |
POST /v1/pay4fun/clock/advance | Moves the clock forward and runs the steps that became due |
GET /v1/pay4fun/objects | Lists sandbox objects |
GET /v1/pay4fun/objects/{kind}/{id} | One object |
GET /v1/pay4fun/deliveries | Lists the webhooks sent |
GET /v1/pay4fun/deliveries/{id} | One webhook |
POST /v1/pay4fun/deliveries/{id}/resend | Tries to deliver it again now |
GET /v1/pay4fun/actions | Lists the actions and their parameters |
POST /v1/pay4fun/actions/{id} | Runs an action |
GET /v1/pay4fun/chaos | Chaos configuration per area |
PUT /v1/pay4fun/chaos/{area} | Changes the chaos of deposit, payment or account |
PUT /v1/pay4fun/homolog | Turns autoProcessPayments on or off |
Control API errors use {"error": {...}} with lower-case codes (for example pay4fun_not_active, unknown_action, action_failed, wait_timeout), different from Pay4Fun's shapes.
Objects and notifications
kind is one of deposit_intent, payment_intent, pix_key, limit_request or contact. id is the Pay4Fun API id (the intent, request or contact id; for keys, {conta}:{value}), and status uses the write vocabulary (Pending, Released, PendingPSP, Completed, Error…).
/objects filter | Example |
|---|---|
kind | kind=deposit_intent,payment_intent |
status | status=Released,Completed |
id | id=<intent-id> |
external_id | external_id=deposito-456 |
since | since=2026-11-05T20:00:00Z (updated since) |
limit | 50 by default, up to 200 |
/deliveries filter | Example |
|---|---|
kind | kind=deposit or kind=payment |
event | event=Success,FAILED (Success, Rejected, FAILED, RETURNED, Expired, Released, Declined) |
status | status=failed (pending, success, failed, skipped) |
ref | ref=<intent-id> |
since, limit | as above |
Filters take several comma-separated values.
Wait
GET /v1/pay4fun/wait answers as soon as something matches the filters, or 408 wait_timeout. Parameters: on (object or delivery), the filters above (at least one of id, external_id, kind, status, event and ref) and timeout in seconds (default 25, maximum 50). While waiting, the simulator runs the due steps.
curl --url 'https://api.mimicr.dev/v1/pay4fun/wait?on=delivery&kind=deposit&event=Success&ref=<intent-id>&timeout=30' \ --header 'Authorization: Bearer mk_...'
npx mimicr wait pay4fun object kind=payment_intent external_id=pedido-123 status=Completed npx mimicr wait pay4fun delivery kind=payment event=Declined ref=<intent-id> --timeout 50
Actions of the other side
curl --request POST \
--url https://api.mimicr.dev/v1/pay4fun/actions/deposit.pay \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "intentId": "deposito-456", "payer": "carla" }'{
"ok": true,
"action": "deposit.pay",
"message": "Intent 596a71a0-72de-4f09-8b5f-05b0e9230adc: Error. Webhook de depósito enviado.",
"data": { "id": "596a71a0-72de-4f09-8b5f-05b0e9230adc", "externalId": "deposito-456", "status": "Error" }
}In the CLI: npx mimicr action pay4fun deposit.pay intentId=deposito-456 payer=carla (true and false become booleans). Intent ids also accept the externalId. An action that doesn't apply to the current state answers 422 action_failed with the reason.
| Action | Parameters | Effect |
|---|---|---|
deposit.pay | intentId (required), depositId (default: the first pending one), payer (ana default, bruno, carla, davi; for Pix-ITP the default is the holder of data.document), or document and name | The payer pays a deposit; the outcome follows the rules in Sandbox testing and the webhook is sent |
deposit.fail | intentId, kind (Rejected or Failed) (required), depositId | The bank refuses (Rejected, AM02) or the screening fails it (FAILED, DEP-114) |
deposit.expire | intentId (required), depositId | A pending deposit's QR Code expires now (expiry webhook) |
deposit.complete_refund | intentId (required) | The bank completes the requested refund now: RETURNED webhook and a statement debit |
payment.process | paymentId (required) | Moves one step now: Pending → validation → PendingPSP; PendingRetry → new attempt; PendingPSP → Completed |
payment.settle | paymentId (required) | The SPI confirms a PendingPSP payment: Completed, debit, fee and Released webhook |
payment.decline | paymentId (required), code (default AC03), description | The SPI refuses a payment in flight: Error, withdraw-errors and Declined webhook |
pixkey.confirm | account (transactional or owner), key (required) | Confirms ownership of an EMAIL or PHONE key (PENDING → ACTIVE) |
limit.review | requestId, approve (required), reason | The review approves (the limit becomes the requested amount) or refuses an increase request |
Hosted pages
The pay4fun.mimicr.dev host serves, without a token, the pages the API responses point to:
/checkout/{intentId}(the intent'surl): shows the pending deposits with the copy-and-paste code and pays with the chosen test payer./itp/{depositId}(thereferenceof aPix-ITP): the payer's bank, with Authorize and Refuse, which then returns to theredirectUrl.
Homologation
curl --request PUT \
--url https://api.mimicr.dev/v1/pay4fun/homolog \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "autoProcessPayments": false }'| Switch | On (default) | Off |
|---|---|---|
autoProcessPayments | Payments settle on their own ~3 s after being sent to the SPI | They stop at PendingPSP until payment.settle or payment.decline |
Or with the CLI: npx mimicr put /v1/pay4fun/homolog autoProcessPayments=false.
Clock
curl --request POST \
--url https://api.mimicr.dev/v1/pay4fun/clock/advance \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "minutes": 10 }'The body takes seconds, minutes, hours and days, added up, up to 400 days per call. After moving forward, the due steps run at once. In the CLI: npx mimicr clock pay4fun +30m, +2h or +1d.
Common uses:
- Expire a
Pix-QrDynamic(300 s by default). - Expire the token (300 s) and test the
401. - Make payment retries (1 min with
onFailRetry) and webhook retries due. - Turn over the daily window of the account limits.
A reset sets the clock back to real time.
Chaos
curl --request PUT \
--url https://api.mimicr.dev/v1/pay4fun/chaos/deposit \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "enabled": true, "apiErrorRate": 20, "apiErrorStatus": 503, "latencyMinMs": 500, "latencyMaxMs": 2000, "opsFailRate": 10, "opsFailCode": "FAILED" }'| Field | Meaning |
|---|---|
enabled | Turns the area on or off |
apiErrorRate | % of calls that answer an error |
apiErrorStatus | 500, 503 or 429 |
apiErrorWhen | before (nothing is processed) or after (processes and answers an error) |
latencyMinMs, latencyMaxMs | Extra latency, up to 20,000 ms |
opsFailRate, opsFailCode | % of operations that fail: in deposit, Rejected or FAILED (when the deposit is paid); in payment, AC03, AM04, AB03 or RR04 (when sent to the SPI, with the same retry rule as the amount table: AB03 and AM04 are recoverable, AC03 and RR04 decline); account has none |
webhookFailRate | % of notifications whose first attempt fails (deposit and payment) |
webhookDuplicateRate | % of notifications delivered twice (deposit and payment) |
The areas cover /deposit/... (deposit), /payment/... (payment) and everything else (account: account, configurations, profile, billings, currencies and Pix). /auth and the hosted pages are not affected by chaos. Fields you don't send keep their current value.
MCP server
Agents can use https://api.mimicr.dev/mcp (Streamable HTTP, same mk_… key). The tools cover overview, reference, control API calls, simulated API calls, actions, waiting and moving the clock. npx mimicr mcp prints the command to connect it in Claude Code and the JSON for other clients.
End-to-end test example
npx mimicr reset pay4fun # your app creates the deposit intent "pedido-42" on https://pay4fun.mimicr.dev npx mimicr action pay4fun deposit.pay intentId=pedido-42 payer=ana npx mimicr wait pay4fun delivery kind=deposit event=Success # your app pays the customer R$ 20.11, which Mimicr declines npx mimicr wait pay4fun delivery kind=payment event=Declined