Guides
Pix webhook
Register the key's URL, receive Pix with a txid and settled refunds, and test the deliveries.
BB notifies your application with POST {webhookUrl}/pix when:
- a Pix with a txid (payment of a cob or cobv) is credited to the key;
- a refund you requested reaches its final state (
DEVOLVIDOorNAO_REALIZADO).
Pix without a txid (static QR, transfer) do not trigger a webhook: get them through received Pix.
1. Register the URL
The webhook is per Pix key. Scope: webhook.write.
curl --request PUT \
--url 'https://api-pix.bb.mimicr.dev/pix/v2/webhook/e488511c-2025-4005-97ac-ff01ff2b5686?gw-dev-app-key=<app-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "webhookUrl": "https://myapp.com/bb" }'The response is 200 with no body. A new PUT replaces the previous URL. BB appends /pix when calling: with the URL above, notifications arrive at https://myapp.com/bb/pix.
URL rules: HTTPS, no IP address and one of these ports: 443, 3001, 4431, 8111, 8443, 8483, 9093, 44300, 50900, 59360. Anything else is 400 WebhookOperacaoInvalida. A key not owned by the receiver answers 400 with "detail": "A chave Pix informada não pertence ao cliente".
On Mimicr's local development server (*.localhost), http URLs and local receivers are accepted too.
Manage it with Get a webhook, List webhooks and Delete a webhook (204). Reference: Configure a webhook.
2. Receive the notification
The body follows Bacen's standard, with pagador:
{
"pix": [
{
"endToEndId": "E000000002026102304576VBYCAW5OYZ",
"txid": "8IpSaxGdL5mkOpTNA6BGvJBDO6",
"valor": "90.00",
"componentesValor": { "original": { "valor": "90.00" } },
"chave": "e488511c-2025-4005-97ac-ff01ff2b5686",
"horario": "2026-10-23T01:57:15.00-03:00",
"infoPagador": "Pedido 1",
"pagador": { "cpf": "93492239293", "nome": "VICTOR LOPES DORNELES" }
}
]
}In a refund notification, the same Pix comes with devolucoes[], each with id, rtrId, valor, natureza, horario and its final status.
- Answer 200 or 201 quickly. Use the
endToEndIdto deduplicate: the same event may arrive more than once. - Confirm the payment by getting the charge (Get an immediate charge) before releasing the order.
Security
BB neither signs the webhook nor sends an authentication header. In production, the origin is validated by mTLS: BB presents its client certificate and your server needs an A1 certificate from a trusted CA. BB recommends not validating by IP range.
Mimicr does not reproduce mTLS: deliveries go out without a client certificate, with Content-Type: application/json and User-Agent: BB-Webhook/1.0.
Retries
| Value | |
|---|---|
| Attempts | Up to 3 (the first plus 2) |
| Interval | 10 s between attempts |
| Failure | Any response outside 2xx, or no response within 10 s |
The policy comes from BB's documentation ("até 3 vezes num intervalo de 10 segundos"); the exact reading (3 sends, 10 s apart) is Mimicr's.
Homologação and Mimicr
In homologação BB does not send webhooks for simulated payments: the portal offers a manual "Disparar evento" instead. In Mimicr:
- payments (the simulator,
pix.pay_cob, boleto with Pix) send the webhook normally; - turn on the
noWebhooksOnSimulatedPaymentstoggle (PUT https://api.mimicr.dev/v1/bb/homolog) so payments through BB's simulator do not notify, as in homologação; - the
pix.webhook_testaction plays the "Disparar evento" role: it sends a fictitious Pix (txidTESTEWEBHOOK0000000000000001, R$ 1.00) to the key's URL, a single attempt.
npx mimicr action bb pix.webhook_test chave=e488511c-2025-4005-97ac-ff01ff2b5686
Follow the deliveries
Each notification becomes a delivery (kind pix, event pix or devolucao, ref the endToEndId or the refund's e2eid:id). Wait for it in your test:
curl --request GET \ --url 'https://api.mimicr.dev/v1/bb/wait?on=delivery&kind=pix&ref=E000000002026102304576VBYCAW5OYZ&timeout=30' \ --header 'Authorization: Bearer mk_…'
Or npx mimicr wait bb delivery kind=pix ref=E000000002026102304576VBYCAW5OYZ. The response carries status (success, pending, failed), attempts, last_status_code and the body sent. Resend with POST https://api.mimicr.dev/v1/bb/deliveries/{id}/resend.
To test failures, turn on the API Pix chaos (PUT https://api.mimicr.dev/v1/bb/chaos/pix with "enabled": true, webhookFailRate and webhookDuplicateRate): the first attempt fails or the delivery arrives twice. See Sandbox control.