The plugin supports intra-PSP transfers and refunds. It settles them internally and reports each one to BACEN through TRCK002.
Detection
The plugin marks a transfer as intra-PSP when the destination ISPB matches your configured
PIX_ISPB:
Detection is internal. The initiation response and the cashout status match an external transfer. The plugin routes an intra-PSP transfer through the internal settlement path instead of BTG.
Processing model
An intra-PSP transfer uses the same Midaz routing as an external transfer, through the
@external transit account. The ledger behavior is identical. The plugin settles the transfer synchronously and does not wait for BTG webhooks.
The plugin creates two Midaz transactions per transfer:
- Cashout —
source → @external(pending: false) - Cashin —
@external → destination(pending: false)
CashinApprovalCommand and CashinSettlementCommand pipelines as an external cash-in. These pipelines run CRM alias validation, balance checks, Pix key ownership, collection completion, and fee calculation.
Flow
The cashout responds with
PROCESSING, like an external cashout that waits for BTG. The plugin delivers the final status (COMPLETED or FAILED) asynchronously through an outbound webhook. The intra-PSP endpoint is idempotent, so worker retries never duplicate transactions.TRCK002 regulatory reporting
The plugin reports every successful intra-PSP transaction to BACEN through BTG’s TRCK002 endpoint.
- TRCK002 reporting is non-blocking. A report failure never rolls back the Midaz transaction or the transfer completion. The plugin retries a failed report.
- The plugin creates a
TransactionReportfor each transaction. After BTG accepts the submission, the report status becomesPROCESSINGand carries apactualId. - BTG sends report status updates through a CAMT025 webhook, typed
PIX_INTERNAL_TRANSACTIONS_REPORT. The webhook moves the report toCONFIRMED(terminal) orERROR(recoverable). - You can also query a report by end-to-end ID or return identification when a webhook does not arrive.
Intra-PSP refunds
The plugin also processes a refund internally when the original cash-in was intra-PSP:
- The plugin detects intra-PSP from the original transfer, when its source and destination ISPB match.
- It debits the refund requester (
requester → @external). It then delivers the refund cash-in to the original sender through the same queue and endpoint pattern. - The plugin reports the refund to TRCK002 with a
returnIdentification. - The plugin persists a
REFUNDoutbound webhook (DICT flow) to notify the requester, and the intra-PSP cash-in settlement queuescashin.completedfor the original sender.
Failure reasons
The plugin delivers a cash-in validation failure asynchronously through the
cashout.failed webhook. For an intra-PSP failure, the webhook carries the reason INTRA_PSP_REJECTED and a sanitized message. Common messages:
Next steps
- Webhooks — Event envelope, retries, and routing
- Refund operations — Distributed refunds and unblocking
- Setting up the integration — ISPB and worker configuration
- API reference — Full API documentation

