Confirm a disbursement already paid to the worker
Records the gateway’s own durable fact that a client bank ALREADY paid a worker. This is NOT a Dataprev operation: no rail credential is used, no government boundary is crossed, and Dataprev publishes no disbursement-confirmation operation to proxy. The gateway records what the client asserted; it asks no downstream product whether the payment is plausible.
It accepts ORPHAN confirmations — money for a contract this deployment never registered locally — and a contract may be disbursed in MORE THAN ONE payment. The identity of a confirmation is (tenant, numero_contrato, payment_reference), so a second payment under a different reference on the same contract is a first acceptance with its own fact, never a conflict.
receipt_pdf_base64 is an optional PDF receipt of the payment, retained for five years. It can be sent only with the first acceptance of the payment: there is no late attachment, so a new key carrying a receipt over a confirmation that has none is refused. Under the same key the receipt is part of the request, absent included: a retry that adds, drops or changes it is 422 IDEMPOTENCY_KEY_REUSE. The 202 then carries receipt_digest_sha256, the SHA-256 of the decoded PDF; the file is read back from the receipt route.
X-Idempotency is mandatory, opaque, 1..128 bytes, and never defaulted. Two keys differing in one byte are two keys, and there is no X-Idempotency-Key alias.
| Case | Status | X-Idempotency-Replayed |
|---|---|---|
| First acceptance | 202 | absent |
| Same key, same request, served from the transport cache | 202, the identical bytes | true |
| Same key, same request, served from the durable authority | 202, the identical bytes | absent |
| Same key, divergent request | 422 — never the earlier body | whatever the shared middleware wrote |
| New key, same payment | 202, the same body | absent |
| New key, same payment reference, different money | 409 DISBURSEMENT_PAYMENT_CONFLICT | whatever the shared middleware wrote |
| New key, same payment, a receipt over a confirmation without one, or a different receipt | 409 DISBURSEMENT_RECEIPT_CONFLICT | whatever the shared middleware wrote |
| New key, same payment, no receipt over a confirmation that has one | 202, the stored body with its receipt_digest_sha256 | absent |
PostgreSQL is the authority on every row. The transport idempotency cache is a best-effort accelerator over it, in BOTH directions: whether that cache fails before the request is decided or after the confirmation is already committed, the answer is the durable one and the only difference on the wire is that the replay header is absent. A cache failure never turns a recorded payment into a 503. That is a different failure from a shared Redis outage, which the tenant rate limiter refuses first.
Encabezados
Mandatory opaque replay key, 1..128 bytes of valid UTF-8, preserved byte for byte. There is no default, no X-Idempotency-Key alias, no case folding and no normalization: two keys differing in one byte are two keys.
1 - 128"idem-desembolso-0001"
Parámetros de ruta
The rail contract number the money was paid against (Manual 004 §2.2.2 p.18: Texto, 15). Exact, control-free UTF-8, bounded in BYTES: no trimming and no case folding. Read to name the contract's originador and fund on the confirmation fact and to mark orphans on the list; it never refuses a confirmation — an orphan for a contract this deployment never registered is first-class and its fact goes out without parties.
1 - 15"99999999999AN1"
Cuerpo
The client's opaque payment reference — a Pix EndToEndId, a TED protocol number, an internal settlement id. Valid UTF-8, 1..256 bytes, preserved byte for byte with no trimming, case folding or normalization.
256"E32074986202608011200A1B2C3D4E5F"
Optional PDF receipt of the payment, RFC 4648 section 4 base64 with canonical padding: no line breaks, no data: prefix, no non-zero pad bits. The decoded file starts with %PDF-, ends with %%EOF and holds 1..3145728 bytes. Retained for five years; it can be sent only with the first acceptance of the payment and never attached later. Absent or null means no receipt; an empty string is refused.
1 - 4194304"JVBERi0xLjQKJSVFT0YK"
Respuesta
The confirmation is durably recorded. A replay of the same payment — under the same key or a new one — answers with the identical body.

