Authorize a collection attempt
Mono calls this endpoint, the authorization.url configured on the
collection, while a payment is in flight. Your answer decides whether
the payment proceeds.
Unlike every other webhook in this document, your response is not acknowledged and discarded — it is the point of the call.
Where this sits
An attempt is decided by three layers, in this order, all inside the network's synchronous request:
- Mono's own rules — the collection is enabled, in a valid state, not expired or pruning, amounts within limits, payer allowed.
- You, through this endpoint, when the collection carries an
authorizationblock. - The receiving bank, which confirms the destination account.
You are therefore asked before the bank has spoken. Approving here
lets the payment go on toward bank confirmation; it does not mean the
payment settled — the final truth arrives on
collection.attempt_successful or collection.attempt_unsuccessful.
If Mono's own rules reject the attempt, you are not called at all. The
same holds in the rare case of an incident on Mono's side that prevents
the request from being signed: the attempt is rejected with
authorization_unavailable, never resolved through your
failure_mode, which describes only what your endpoint did.
Your answer
Answer with an HTTP 200 and a JSON body. To approve:
{"approved": true}To decline, add a reason from AuthorizationDeclineReason:
{"approved": false, "reason": "payer_limit_exceeded"}Either answer may carry a flat metadata map, which Mono stores on the
attempt:
{
"approved": false,
"reason": "payer_limit_exceeded",
"metadata": {"monthly_cap": 1000000, "used_this_month": 985000}
}The response body below has the full rules: the accepted media types, the size limits, and what makes an answer invalid.
Deadline and delivery
You have 4 seconds. Mono does not retry: there is at most one
request per attempt. If you answer late, not at all, or with anything
other than a valid answer, the collection's failure_mode decides —
fail_closed rejects the payment, fail_open lets it continue to the
bank.
Because there are no retries, a repeated x-idempotency-key is not
something Mono produces today. Answer consistently for a given key
anyway: it is the contract, and it costs you nothing.
Verifying the signature
Every request carries a Mono-Signature: t=<unix seconds>,v1=<signature>
header, where the signature is the HMAC-SHA256 of "<t>.<raw body>"
under your secret, in lowercase hexadecimal. It is the same scheme that
signs every webhook in this document, so one verification routine covers
this call and all of them:
- Split the header on
,and readtandv1from it. - Build the signed payload as
t, a., and the body exactly as it arrived, byte for byte. Do not serialize a parsed body back to JSON: a document with the same meaning but a different key order, whitespace or escaping has a different signature, and every request then fails to verify. Capture the raw body before anything parses it. - Compute the HMAC-SHA256 of that payload with your secret, encode it
in lowercase hexadecimal and compare it with
v1using a constant-time comparison.
Two things are specific to this call:
- A different secret signs it. This request is signed with your
tenant's
authorization_request_secret— the one prefixedauthsec_, shown in the credentials tab — and not with thewhsec_secret of a webhook subscription. They are separate values with separate rotation; reaching for the wrong one is the first thing to rule out if nothing verifies. - The clock-skew window is yours to enforce. Reject requests whose
tis more than 5 minutes from your own clock. Mono cannot enforce replay protection on your behalf.
Rotating the secret
You rotate the secret from the credentials tab, and rotation is an immediate cutover. The new secret is generated and shown at the moment you rotate, and Mono signs with it from that instant — there is no grace period, and no request is signed with the previous secret after that. Rotate only when you can deploy the new value right away.
Sandbox and production hold separate secrets.
One thing to know about sandbox: the simulator that triggers attempts
there, POST /api/v1/sandbox/collections/attempts, takes no
credentials. Anyone who knows one of your sandbox collection keys can
use it to make Mono call your authorization endpoint. Clear
authorization from your sandbox collections once you are done
testing.
Parámetros de encabezado
Timestamp and HMAC-SHA256 signature. See the description above.
^t=[0-9]+,v1=[0-9a-f]{64}$The attempt id, in the same public prefixed form the attempts GET
returns. Identical to id in the body.
^[A-Za-z]{2,7}_[\w-]{22}$Cuerpo de la solicitud
application/json
Definiciones de TypeScript
Usa el tipo request body en TypeScript.
The attempt being authorized. This same value travels in the
x-idempotency-key header.
^[A-Za-z]{2,7}_[\w-]{22}$^[A-Za-z]{2,7}_[\w-]{22}$The collection's external_id, the identifier you set when you
created it. It travels here so your rules can key off your own
identity for this collection — the end user's wallet, the account it
funds — without resolving collection_id against your database
inside the 4 second budget.
1 <= length <= 255^[A-Za-z]{2,7}_[\w-]{22}$Information about the payer
Information about the payer's account
Type of the collection's own Bre-B key — the destination this payment was sent to.
"identification" | "cellphone" | "email" | "alphanumeric" | "merchant_code"The collection's own Bre-B key, the one the payer sent to. Do not
read it as the payer's identity — the payer is payer and
payer_account. On a permanent collection key this value is the same
on every request, so keying your rules off it would treat every payer
as the same user.
1 <= length <= 92length <= 35The QR code the payment was made with. Null when the payment did not enter through a QR code.
Cuerpo de la respuesta
application/json
Ejemplos de solicitud
/authorize_collection_attempt