Webhooks
Signed events for orders, the eSIM's life and your balance, with retries and a delivery log.
Set up an endpoint
Webhooks tell your server what happens after you order: the order went through or failed, the traveller installed the eSIM, it connected, used 80% of its data, expired; your balance ran low or was topped up.
- Create an HTTPS endpoint that accepts
POSTwith a JSON body. - Register it with
/webhook/configuration(or in the dashboard under Webhooks). The first URL creates your signingsecret, which is in the answer. Store it with your other secrets. - Optionally limit
events(default: all;nullresets to all) and setlowBalanceThresholdin USD to receivebalance.low.
Live and Sandbox have separate settings and secrets. Rotate a secret with /webhook/secret/rotate, and read the current settings with /webhook/get.
The request we send
Every event is a POST with a JSON body { id, event, createdTime, environment, test, data }:
| Field | Meaning |
|---|---|
id | Unique per event. Also in the Burj-Delivery-Id header. Use it to ignore duplicates. |
event | The event name, also in the Burj-Event header. |
createdTime | When it happened, ISO 8601 UTC. |
environment | production or sandbox |
test | true for events sent by /webhook/test |
data | The event's payload: see the event catalog. |
Verify the signature
Anyone can POST to your URL, so check every request came from Burj before acting on it. The Burj-Signature header looks like t=<unix seconds>,v1=<hex>, where:
v1 = hex( HMAC_SHA256( secret, t + "." + rawBody ) )- Use the raw body bytes, before any JSON parsing. Re-serialised JSON won't match.
- Compare in constant time.
- Reject the request if
tis more than 5 minutes away from your clock (replay protection). - Answer 400 if the check fails, and don't process the event.
Answer fast; retries
Any 2xx within 10 seconds counts as delivered. Answer first, then do the work (queue it), so a slow database never turns into a retry.
On an error, a timeout or a non-2xx answer, Burj retries after:
| Attempt | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|
| Wait | 1 min | 5 min | 30 min | 2 h | 6 h | 12 h |
That's 7 attempts over about 21 hours. After the last one the delivery is FAILED. You can send any delivery again from the delivery log.
Handle duplicates
Duplicates are rare but possible (for example when your 200 got lost on the way back). Store each event's id and skip the ones you've seen. Events can also arrive out of order: rely on the status in the payload, or fetch the eSIM with /{orderId}/data, rather than on arrival order.
Test your endpoint
/webhook/testsends awebhook.testevent (or a sample of another event) to your URL right now and tells you how your server answered.- In the sandbox, the eSIM simulator sends the real
esim.*events, and a simulated failure sendsorder.failed. - Working locally? Expose your server with a tunnel and register the tunnel's HTTPS URL in the sandbox.
Delivery log
/webhook/deliveries lists every event sent to you, newest first, with the payload, attempts and your server's last answer. Filter by status (PENDING, RETRYING, DELIVERED, FAILED) or event. After fixing your endpoint, resend what failed.
Event catalog
| Event | Sent when |
|---|---|
order.completed | An order went through (also partial ones, with partial) |
order.failed | The provider failed; the amount is back in the balance |
esim.installed | The traveller installed the eSIM |
esim.activated | The eSIM connected for the first time (plan started) |
esim.usage_80_percent | 80% of the data is used (once per eSIM) |
esim.expired | The plan ended |
balance.low | Balance went under your lowBalanceThreshold (once, re-armed when it goes back above) |
balance.topped_up | A top-up payment was credited |
webhook.test | Sent by /webhook/test only |