Integration flows
Three ways to consume /api/verify (short wait, polling, and SSE) plus idempotency replay. Pick whichever matches how your app handles latency.
POST /api/verify defaults to synchronous: the call blocks until the upstream finishes, then returns the receipt. For most callers (a single
on-demand verification triggered by a user click) that's fine.
Sending waitMs, an Idempotency-Key header or a webhookUrl switches the call to the flows below. A key sent with no waitMs does not wait at all: it returns 202 at once, and you pick the result up by polling or SSE.
When you can't or don't want to hold the request open (mobile network, server with strict request budgets, queue-of-many architecture), use one of the three async-aware flows below. All three share the same submit endpoint and result envelope; what differs is how the client waits.
Short Wait
Submit with waitMs to ask the server to block up to waitMs milliseconds. If the verification finishes before the deadline, you get the same 200, 400 or 502 response a sync call would return. If it doesn't, you get 202 + a request id and the URLs you'd use to poll or stream.
Completed inside the wait window: 200
Still running at the deadline: 202
The verification keeps running on the server. Follow up via polling or SSE; both work against the same requestId.
The wait is capped at 30 000 ms server-side: a waitMs from 30 001 to 60 000 is silently clamped. Above 60 000, or not a whole number, is a 400 invalid_request.
Polling
Use when your environment can't keep a long-lived connection open but you can call back every few seconds.
While the request is still queued: 202
Once the row resolves: 200 / 502
A success is a 200. A failure is a 502 when the bank was reached, and a 400 when it was not (a timeout, a busy bank, an unsupported URL).
Same envelope as the sync flow, with processingStatus and requestId added. fetchedAt here is when the request finished, not when the receipt was first fetched from the bank. Only the key that made the request can read it:
Cadence suggestion: 1.5 to 3 s between polls. Faster than one per second buys nothing, because the verification runs at its own pace regardless.
A poll reads an existing row, so it counts against your per-minute request rate but never against your plan's verification cap. Only the original submit can spend an uncached verification, and only if the receipt was not already cached. See rate limits for the difference.
Server-Sent Events (SSE)
Use when the client can keep a connection open and wants the result as soon as it's ready (instead of polling on a timer).
EventSource from the browser:
Event types
| Event | When | Payload |
|---|---|---|
status | Once, when the row is created | { type: 'status', status: 'pending', ts } |
completed | Verification finished successfully. Stream closes after. | { type: 'completed', ok: true, cached, receipt, httpStatus, ts } |
failed | Verification finished with an error. Stream closes after. | { type: 'failed', error, httpStatus, ts } |
timeout | The server is closing the stream at the 5-minute lifetime cap. | { type: 'timeout', message } |
The stream also sends an unnamed comment (: ping) every 15 s to keep proxies from idling the connection.
Replay-on-reconnect
If the verification resolves between your submit call and the moment you subscribe to the SSE stream, you don't miss the terminal event; the server replays the last-seen event on connect. For about 5 minutes that comes from memory. After that it comes from the stored request, so a late subscriber still gets the terminal event, and so does the GET polling endpoint, for 30 days.
Idempotency
Add an Idempotency-Key header to POST /api/verify so that sending the same call twice, after a dropped connection for example, does not start a second check. The first call with a given key (per API key) creates a request and returns its id. Any later call with the same key returns the current state of that same request, even if the URL in the later call differs.
The replay carries the same requestId as the first response. What it says depends on where that request is:
- Still running:
202with the samestatusUrlandeventsUrl. Poll it or open the event stream. - Finished: the same result as the first time. A verified receipt stays a
200. A failure stays the same400or502, including a timeout because the bank was down. links.et does not ask the bank again for that key. - Older than 30 days: the request has been deleted, so the key starts a new one.
So a key stands for one try, not one order. When a try fails because the bank was slow or down, retry with a new key. A timeout or 5xx from the bank is remembered for one minute (the response says cached: true), so wait at least that long before you try again. A bank 4xx such as receipt not found is remembered for 24 hours.
A key sent without waitMs returns 202 straight away, so add waitMs when you want the answer in the same call. A replay also repeats the first answer's history, so your own retry never reads as a second customer, and its receiverCheck, which answers for the expect the first call sent.
Do not use the receipt reference as the key. One failed try would then answer for that receipt for 30 days. Use a UUID, or any string up to 256 characters, made fresh for each try, and keep "one receipt pays one order" in your own database.
Webhooks
Send webhookUrl in the body and links.et POSTs the result to your server when the verification finishes, signed and retried for up to about 8.5 hours. Nothing to poll and no connection to keep open. See Webhooks.
When to use which
| Flow | Best for | Trade-off |
|---|---|---|
| Sync (default) | One-off verifications triggered by user interaction; cached receipts | Holds the HTTP request open. Instant on a cache hit, but see below for the worst case |
| Short wait | Cached-most-of-the-time receipts where you accept queue fallback when it isn't cached | Up to 30 s of held connection in the worst case |
| Polling | Background jobs, queue workers, mobile networks | Slightly stale; uses more HTTP requests |
| SSE | Browser UIs that want the result instantly | Needs a long-lived connection; harder to put behind some proxies |
You can mix and match. A common pattern is: submit with waitMs: 2000. If 202, open SSE for the result. If your SSE connection drops, fall back to polling once a second.
What a busy bank does to a sync call
A cached receipt returns immediately. An uncached one has to reach the bank, and we are a polite client: each upstream host gets a token bucket per egress identity, so when a bank is saturated your call waits for a slot before the fetch even starts.
That makes the sync worst case much longer than one fetch timeout:
| Stage | Bound |
|---|---|
| Waiting for an upstream slot | 30 s, longer on a deliberately slow host, hard ceiling 120 s |
| The fetch itself | 20 s per attempt, 10 s for telebirr, 45 s in all for HuluBeje |
| One retry, on a different egress identity | 20 s, 10 s for telebirr |
So a sync call against a struggling bank can hold the connection for well over a minute. There is one retry, and none at all for a metered link like Siinqee. telebirr is the exception: its receipt server sometimes takes a request and never answers, while the next request answers in under a second, so a telebirr request with no answer after 2 s gets another one, on a different egress identity when one is free, while the first stays open, and the first answer wins: up to 8 requests and 30 s in all.
If the queue is full or the wait runs out, the call gives up rather than
hanging, and the error reads like gave up waiting 30s for a slot on transactioninfo.ethiotelecom.et. Today that returns HTTP 400, because the
response never got an upstream status code to report. It is a "come back
later", not a complaint about your request, so retry it with backoff the way
you would a 502.
This is the reason waitMs exists. Submit with a deadline you are happy to
hold, take the 202, and pick the result up by polling or SSE instead of
holding a socket open through a bank outage.