The partner’s documentation prevails over this page. Your institution validates the flow and implements it on the Lerian APIs. See how to read the diagrams.
Participants
- Your institution. Calls the Payments BTG API and receives its webhooks.
- Payments BTG. Reserves the amount in Midaz and pays the bill at BTG.
- Midaz. The ledger that holds the accounts of your customers.
- BTG. The partner that pays the bill.
Before you start
- The paying account exists in Midaz and has a holder.
- Payments BTG is connected to BTG for your institution.
- Configure your webhook with
POST /v1/admin/webhooks. Send an HTTPScallbackUrl, asecretof at least 32 characters, and the events that you want inenabledEvents. Send anIdempotency-Key.
Diagram
Pay a boleto or a utility bill
Pay a DARF
Know when a payment settled
Rules
Pay a boleto, a utility bill or a DARF
- Payments BTG reserves the amount in Midaz before it pays. When the reservation fails, BTG does not receive the payment.
- Send an
Idempotency-Keywith each payment request. The key is a UUID. - A new key starts a new payment. Read the payment before you send a new key for the same bill.
Know when a payment settled
- The webhook of step 3 can arrive before step 2 ends.
- Payments BTG sends only the events that you list in
enabledEvents.
How you know it finished
GET /v1/payments/{id}shows the result:SETTLED,REJECTED,CANCELEDorFAILED.- At your
callbackUrl, the webhooksPAYMENT_SETTLED,PAYMENT_REJECTED,PAYMENT_CANCELEDandPAYMENT_FAILEDshow the same results.
What can go wrong
The Payments BTG error list describes each code.

