Webhooks are the primary notification channel. Polling is the recovery and audit path — not a substitute for push.
Example#
curl -s -X GET "https://api.avrix.io/api/seller/v1/events?cursor=0&limit=100" \
-H "Authorization: Bearer $AVRIX_API_KEY"Design for both: consume signed webhooks in real time, and run scheduled pulls so a missed delivery never strands a paid buyer.
Why webhook-first#
| Benefit | Explanation |
|---|---|
| Latency | Order events reach your backend without waiting for a cron tick |
| Key material | Persist keys from POST /orders; webhooks and GET /orders never echo plaintext |
| Clarity | At-least-once delivery with stable eventId for dedupe |
Recovery surfaces#
| Layer | Endpoint | Typical use |
|---|---|---|
| Order aggregates | GET /api/seller/v1/orders?orderReference=store-order-10432 | Support lookup, webhook gap recovery |
| Order listing | GET /api/seller/v1/orders?from=&to=&cursor=&limit= | Full-ledger reconciliation and disaster recovery |
| Catalog deltas | GET /api/seller/v1/catalog/changes?since= | Catch product/pricing tombstones after outages |
| Webhook deliveries | GET /api/seller/v1/webhooks/{id}/deliveries | Inspect pending / failed attempts in the retry window |
| Delivery replay | POST /api/seller/v1/webhooks/{id}/deliveries/replay | Re-send after your endpoint was down — new eventId with replay markers |
| Cross-endpoint cursor | GET /api/seller/v1/events?since= | Forward-only cursor over delivery rows when inbound HTTP is unavailable |
| Request trace | GET /api/seller/v1/requests/{requestId} | Correlate X-Request-Id from errors |
Missed webhook recovery#
- Confirm the endpoint failure in GET /webhooks/{id}/deliveries (status, response code, timestamps).
- Replay with POST /webhooks/{id}/deliveries/replay when the original is still in the replay window. Replays carry a fresh
eventId— correlate via the replay envelope’s original event id. - For orders, call
GET /api/seller/v1/orders?orderReference=store-order-10432and compare aggregates to your OMS. - For catalog drift, call
GET /api/seller/v1/catalog/changes?since=<ISO8601>and apply tombstones / updates. - Escalate with
X-Request-Id,orderReference, and timestamps when aggregates disagree past your SLA.
Periodic reconciliation job#
Run this even when webhooks look healthy (“trust but verify”).
Suggested daily (or hourly for high volume) loop:
- Page
GET /api/seller/v1/orders?from=<window start>&to=<window end>&limit=100withmeta.nextCursoruntil it isnull— this is Avrix's authoritative list of your fulfilled orders in the window (each row carriesorderReference, derivedstatus,skuId,quantity,fulfilledAt, andkeyIds— key ids, never plaintext). - Diff both ways against your storefront charges for the same window:
- Orphan PSP captures (charge with no Avrix row) — investigate or refund at your PSP.
- Orphan Avrix rows (row with no storefront order) — investigate duplicate idempotency misuse.
- For any row in an unexpected state, drill in with
GET /api/seller/v1/orders?orderReference=…(aggregate includesrefunds[]). - Optionally sweep
GET /api/seller/v1/events?since=for delivery rows you never processed.
Ledger rebuild (disaster recovery)#
After a total store-DB loss, rebuild the complete order ledger from the API alone: page the
listing from your integration launch date to now (from=<launch>&limit=100, follow
meta.nextCursor). Every row maps back to your store order via orderReference; re-request key
material only where the buyer never received it, via the
key recovery runbook — the listing itself never returns plaintext.
Partners without inbound webhooks#
If policy forbids inbound HTTP:
- On purchase, POST /orders with
Idempotency-Key+orderReference→ persist response entitlements immediately. - Poll
GET /orders?orderReference=…until terminal aggregates match. - On mismatch past SLA, escalate with
X-Request-Id. - On finance cycle, reconcile transactions / finance exports independently of webhooks.
Latency realism#
Catalog-class events may arrive on a minute-scale freshness budget. Order hot-path recovery should use order aggregates and delivery replay first, not full catalog polls.