Webhooks
A webhook sends each event of the bank (an authorization, a presentment, a blocked card, a dispute moving on) to your server, a few seconds after it happened.
Subscribing
Section titled “Subscribing”-
Expose an HTTPS address that accepts a JSON
POSTand answers 2xx quickly (process afterwards, in the background). -
Create the subscription, with the event types wanted (
*for all):Fenêtre de terminal curl -s http://localhost:3000/webhooks -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \-d '{"url":"https://your-system.example/ubo/events","description":"Mobile app","events":["authorization.approved","authorization.declined","card.status_changed"]}' -
Keep the secret returned: it shows only once (an administrator can read it again, the read is logged).
-
Test:
POST /webhooks/{id}/testsends a test event and returns your server’s answer.
What you receive
Section titled “What you receive”POST /ubo/events HTTP/1.1Content-Type: application/jsonX-UBO-Event: authorization.declinedX-UBO-Delivery: 01a21e8a-1290-7c51-9b0e-58f2a1c3d7e4X-UBO-Signature: t=1795892683,v1=4f1c9a…e07b
{ "id": "01a21e8a-1179-76a4-ba5f-192a81455b2f", "type": "authorization.declined", "created_at": "2026-11-27T19:44:54.635763+00:00", "data": { "authorization_id": "01a21e8a-1151-…", "card_id": "01a21e8a-0ec9-…", "entity_id": "e0000000-…-000000000011", "status": "declined", "approved": false, "response_code": "1A", "amount": 900000, "currency": "EUR", "channel": "ecommerce", "merchant": { "name": "Fnac", "mcc": "5732", "country": "FR" }, "message_type": "authorization", "source": "api", "captured_amount": 0, "refunded_amount": 0, "reversed_amount": 0, … } }idis the event’s identifier: the same aseventIdon Kafka and in the journal.datais the object’s state after the change (here the operation), read in the same transaction.- The catalogue of types is in Events.
Verifying the signature
Section titled “Verifying the signature”X-UBO-Signature is t=<Unix seconds>,v1=<hexadecimal HMAC-SHA256>, computed with your secret over
"<t>.<raw body>". Verify it before processing, on the raw body (not on rewritten JSON), and refuse a t
too old (over 5 minutes) to prevent replay.
import crypto from "node:crypto";
function verify(rawBody, header, secret, toleranceSec = 300) { const parts = Object.fromEntries(header.split(",").map((p) => p.split("="))); const t = Number(parts.t); if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false; const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex"); return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 ?? ""));}import hmac, hashlib, time
def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool: parts = dict(p.split("=", 1) for p in header.split(",")) t = int(parts.get("t", 0)) if abs(time.time() - t) > tolerance: return False expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, parts.get("v1", ""))Delivery
Section titled “Delivery”- A delivery that gets no 2xx answer (error, timeout, unreachable server) is retried with an increasing delay (30 s × 2ⁿ), 6 times at most.
- Events are delivered at least once: the same
idmay arrive twice. Deduplicate onid. - Order is only guaranteed for one object (one authorization, one card). For a global order, use
created_at. - Each delivery is followed in the portal (Exploitation → Événements → Webhooks) and through
GET /webhooks/{id}/deliveries;POST /webhooks/deliveries/{id}/retrysends it again.

