Webhooks arrive out of order: fetch-before-process and reconciliation
Webhooks can arrive in any order, so don't build on the order they arrive in. Treat each one as a prompt to check, fetch the live object from the provider before you act, and run a regular job that catches anything you missed.
Stripe's docs state that Stripe doesn't guarantee the delivery of events in the order that they're generated, even for events from a single user action.
Checked 9 Nov 2026.
What out of order looks like
Stripe's own example is creating a subscription. That can send customer.subscription.created, invoice.created, invoice.paid and charge.created, and they can reach you in any order.
Event created timestamps are in seconds and can collide. Don't use them to sort events or to spot duplicates. Track event ids instead.
Retries, several endpoints and your own queue workers all add to the shuffle. Your code has to cope with invoice.paid turning up before invoice.created.
Mistakes to avoid
A handler that insists on created before paid will stall or fail when paid arrives first.
Updating your database straight from the webhook body trusts a snapshot that may already be stale. Granting access from invoice.paid without checking the live invoice can act on something a refund or void has since changed.
Don't sleep inside the HTTP handler to wait for an earlier event. It delays your response, invites provider retries and still gives you no ordering. Put the work on a queue instead.
Fetch before you process
First, verify the signature, return a 2xx quickly and queue the event.
Next, skip it if you have already processed that event id. Two events can describe the same change, so key side effects on the resource id too.
Then load the current object from the provider's API, such as the invoice or subscription. Act on that live state, and ignore an event the object has already moved past.
Finally, save the event id so you don't process it twice.
Stripe's docs describe the same approach. If invoice.paid arrives first, fetch the invoice, charge and subscription from the API rather than assuming earlier events landed.
// Worker: invoice.paid, then fetch the live invoice and save it. export async function handleInvoicePaid( event: { id: string; type: string; data: { object: { id: string } } }, deps: { alreadyProcessed: (eventId: string) => Promise<boolean>; markProcessed: (eventId: string) => Promise<void>; fetchInvoice: (invoiceId: string) => Promise<{ id: string; status: string }>; upsertLocalInvoice: (invoice: { id: string; status: string }) => Promise<void>; } ): Promise<'duplicate' | 'applied'> { if (event.type !== 'invoice.paid') throw new Error(`unexpected type ${event.type}`); if (await deps.alreadyProcessed(event.id)) return 'duplicate'; const invoice = await deps.fetchInvoice(event.data.object.id); await deps.upsertLocalInvoice(invoice); await deps.markProcessed(event.id); return 'applied'; }
Watch your API limits
Fetching every object adds API calls. A stripe.dev post on rate-limit-friendly webhook patterns warns about this.
Keep receiving separate from processing. A burst of webhooks then becomes a steady queue of fetches, and you can throttle your workers to stay within limits.
Reconcile on a schedule
The webhook stream alone may be incomplete. For anything involving money, run a regular job that lists provider events or resources for a time window, compares them with your records and fixes any gaps.
Where SolidHooks fits
SolidHooks verifies and stores each event, filters by type, paces and retries deliveries, and lets you replay once your code is fixed (events, retries, rate limits). That keeps intake healthy while your workers catch up.
It doesn't guarantee delivery order. Concurrent deliveries to one destination can finish in any order, and filters pick event types without sorting them. Ordering and reconciliation stay in your code.
Source idempotency runs after the signature check. A duplicate gets HTTP 200 {ok:true, duplicate:true} and isn't stored again. Keep your own check on event.id as well.
Use retry and replay to resend known events. Don't treat the event list or the live stream as an exact way to drain a backlog. Reconcile with the provider instead.
FAQ
invoice.paid before invoice.created and fetch anything it's missing from the API.Get started
The Hobby plan is free for 10,000 deliveries a month. Point your provider at a SolidHooks source, then have your destination verify, queue and act on live provider state. See events for what is stored.