Skip to main content
Webhooks are the primary mechanism the Pix Indirect Plugin (BTG) uses to notify you about Pix-related events in real time. You do not rely on synchronous responses. Instead, you receive asynchronous, event-driven callbacks when relevant changes occur in Pix operations — transfers, refunds, key claims, or MED events. This model gives you:
  • Near real-time updates
  • Decoupled integrations
  • Reliable reconciliation and operational traceability
These webhooks apply only to the Indirect Pix model via BTG.Direct Pix webhooks can differ by connectivity model. A separate page documents them.

Prerequisites


Before you configure webhooks, make sure you have:
  • The Pix Indirect Plugin configured and running (see How indirect participation works)
  • An HTTPS endpoint ready to receive webhook requests
  • Basic understanding of Pix event lifecycle and transaction flows

Why webhooks matter in Pix


Pix is an asynchronous, multi-party system. An API request can succeed before the transaction reaches its final state. The system confirms that state later, after settlement and counterparty acknowledgment. Webhooks allow your system to:
  • Track authoritative transaction status
  • React to refunds, reversals, and MED events
  • Maintain ledger and operational consistency
  • Reduce polling and operational overhead

Event types


You receive events grouped by flow and entity, aligned with BACEN (Banco Central do Brasil) domains. Each event reflects a state transition in the Pix ecosystem. Treat each event as the source of truth.
The two MED 2.0 entities behave differently. The plugin emits FUNDS_RECOVERY after it updates its local record. FUNDS_RECOVERY_EVENT is a pass-through of BTG lifecycle events with no database update. See MED 2.0 — Funds Recovery for the full flow.
DICT (Diretório de Identificadores de Contas Transacionais) is the BACEN directory that manages Pix keys and related operations like claims, infractions, and refunds.

Webhook configuration


To enable webhooks, configure the destination URLs and select which event types your system receives.

Environment variables


You can configure webhook endpoints at entity, flow, or global level. Each flow also has a flow-level URL for all its entities. The plugin uses it when no entity-level URL exists: WEBHOOK_DICT_URL, WEBHOOK_TRANSFER_URL, and WEBHOOK_REFUND_URL.

URL resolution priority


When you configure multiple URLs, the plugin resolves them in this order:
  1. Entity-level URL Example: WEBHOOK_DICT_CLAIM_URL
  2. Flow-level URL Example: WEBHOOK_DICT_URL
  3. Default URL WEBHOOK_DEFAULT_URL
This gives you fine-grained routing control and no duplicate infrastructure.

Request format


Headers


Every webhook request includes standardized headers for traceability and security.

Body structure


The payload schema varies per event type but always represents a state change.

Responses and retry behavior


Expected response


Your endpoint must return an HTTP 2xx status to confirm successful delivery.

Retry strategy


The plugin retries failed deliveries automatically with exponential backoff: Defaults
  • Max retries: 3
  • Timeout per request: 30 seconds
After all retries fail, the plugin moves the event to a dead-letter queue for operational follow-up.

Custom retry settings

You can customize retries and timeouts per event:

Circuit breaker protection


A circuit breaker protects webhook delivery and prevents cascading failures. When the Pix Plugin detects repeated delivery failures (typically consecutive 5xx responses or timeouts), it temporarily pauses webhook calls to the affected endpoint. After a configurable cooldown period, the system performs controlled retry attempts to check if the endpoint has recovered. When the endpoint returns successful responses, the plugin resumes normal delivery automatically. This mechanism gives you:
  • Protection against overloaded or unstable endpoints
  • Graceful recovery without manual intervention
  • Higher overall system stability in production environments
The circuit breaker works alongside retries and exponential backoff. It adds an extra safety layer for webhook delivery.

Transport errors and orphan events


When the plugin receives a refund webhook, it looks up the original transfer along the cash-in → cash-out chain. If no local source matches, the plugin persists the refund as an orphan record for BACEN auditability. It does not drop the refund, so the record stays visible for reconciliation and follow-up. If a source lookup fails at the transport layer, the plugin skips that source and continues. When no source resolves — from a clean miss or a swallowed transport error — the plugin records the refund as an orphan. The plugin aborts only when the transfer-lookup bridge is not configured. originalEndToEndId is the canonical key for all refund lookups. The plugin resolves refunds from both the cash-in → refund and cash-out → refund directions with this field. Always key refunds by originalEndToEndId (the original transfer’s end-to-end ID), not by a single direction-specific lookup path.

Internal transaction reports (intra-PSP)


The plugin settles intra-PSP (P2P) transfers internally. They never reach BTG for settlement, but the plugin still reports them to BACEN through the TRCK002 abstraction. BTG confirms report status through a CAMT025 webhook that carries the entity PixInternalTransactionsReport. The plugin updates the report status when the CAMT025 report webhook confirms or fails. The outbound webhooks fire earlier, when the intra-PSP transfer settles: cashin.completed for the cash-in leg and cashout.completed or cashout.failed for the cash-out leg. For the full internal flow, see Intra-PSP transfers.

Best practices


Event examples


Below are representative examples of webhook payloads you receive from the Pix Indirect Plugin. Expand each entry to view its payload.
Ownership or portability lifecycle events. Use these to track Pix key disputes across institutions.
Dispute and fraud signaling events aligned with BACEN MED rules.
Refund requests and decisions related to MED cases.
Funds Recovery entity status changes. The plugin updates its local record before forwarding the full entity.
Lifecycle events arrive as entityType: FUNDS_RECOVERY_EVENT (pass-through, no DB update), with event values such as FUNDS_RECOVERY_ANALYSED and FUNDS_RECOVERY_COMPLETED.
Incoming and outgoing Pix transfer events.Cash-in (incoming transfer):
Cash-out (outgoing transfer):
Refund settlement events for Pix transactions.Refund cash-in (receiving a refund):
Refund cash-out (sending a refund):

Key takeaway


Webhooks are not optional in Pix Indirect operations. They are the authoritative channel for transaction state, refunds, and dispute handling. A correct webhook implementation gives you:
  • Accurate reconciliation
  • Regulatory compliance
  • Operational resilience
  • Predictable customer experience
For production environments, always design webhook consumers as idempotent, asynchronous, and observable systems.

Next steps


Now that you understand how webhooks work in Indirect Pix, explore these related topics: