Skip to content
Portal

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.

  1. Expose an HTTPS address that accepts a JSON POST and answers 2xx quickly (process afterwards, in the background).

  2. 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"]}'
  3. Keep the secret returned: it shows only once (an administrator can read it again, the read is logged).

  4. Test: POST /webhooks/{id}/test sends a test event and returns your server’s answer.

POST /ubo/events HTTP/1.1
Content-Type: application/json
X-UBO-Event: authorization.declined
X-UBO-Delivery: 01a21e8a-1290-7c51-9b0e-58f2a1c3d7e4
X-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, … } }
  • id is the event’s identifier: the same as eventId on Kafka and in the journal.
  • data is the object’s state after the change (here the operation), read in the same transaction.
  • The catalogue of types is in Events.

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 ?? ""));
}
  • 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 id may arrive twice. Deduplicate on id.
  • 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}/retry sends it again.