Register a MED inbound refund credit (THIRD RAIL — moves money)
Posts the receiving-side refund CREDIT on the local Midaz ledger when SPI settles a MED devolucao (the plugin is the SGCT server; JDPI calls this after the pacs.004 is received, contract §2.28). It posts a balanced COMMITTED double-entry (clearing credit, recipient debit-mirror) and mints the idCreditoSgct. The Authorization (Bearer) header is mandatory on this financial ingress: a missing/invalid token is a coded 401. A re-delivered credit for the same endToEndIdDevolucao echoes the prior idCreditoSgct with no second post (idempotent).
Authorizations
JWT bearer token issued by the identity provider.
Headers
Bearer access token (the financial-ingress gate; the handler fails closed with PIX-0082 when absent).
"Bearer eyJ..."
Idempotency key (= the endToEndIdDevolucao). Mandatory per the MED SPI credit contract.
"D1111111120240918150000000000099"
Body
EndToEndId of the devolucao (pacs.004; the natural key / idempotency anchor, 32-char).
"D1234567820240101000000000000099"
The JDPI request id of the credit notification.
"f1e2d3c4-b5a6-7890-1234-567890abcdef"
Credited refund amount, in reais (a JSON number; JDPI 9.3.3).
150.85
Refund reason code (BE08/FR01/MD06/SL02; §9.3.3 Obrg=Sim, tolerated-absent).
"BE08"
SPI accounting date (§9.3.3, Obrg=Sim, aaaa-mm-dd).
"2024-09-20"
SPI settlement instant (§9.3.3, Obrg=Sim, UTC).
"2024-09-20T04:00:01.001Z"
Recebedor-informed original instant (UTC).
"2024-09-20T04:00:01.001Z"
EndToEndId of the original contested payment (32-char; §9.3.3 Obrg=Sim, tolerated-absent).
"E1234567820240101000000000000001"
Payer-to-payee free-text information (§9.3.3, Obrg=Nao).
"Compra Paga"
Free-text refund detail.
"Devolucao MED."
Payer (pagador) identity; retained for audit/observability.
Recipient (recebedor) identity; the credit distribute leg target (design D2 mirror). recebedor.ispb is enforced by Validate().
Response
OK
The SGCT credit-commit instant (UTC, RFC 3339).
"2024-09-20T04:00:01.001Z"
The plugin-minted credit-entry id (GUID).
"58F752C5-6376-3252-8305-A2DE3A8525D3"
The JDPI request id (echoed).
"f1e2d3c4-b5a6-7890-1234-567890abcdef"

