Stripe's docs say your endpoint must quickly return a 2xx before any complex logic that could cause a timeout. The webhooks guide doesn't give an exact cutoff in seconds, so don't design around one. Acknowledge first, then do the work.
app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
let event;
try { event = stripe.webhooks.constructEvent(req.body, req.get('stripe-signature'), secret); }
catch (e) { return res.status(400).send(e.message); }
await queue.add(event.type, { id: event.id }); // fast: store it, don't process it
res.sendStatus(200);
});
// a separate worker processes the queue and de-duplicates on event.id
On serverless platforms you usually can't keep working after you've returned. Hand the event to a real queue (or your platform's background or after-response feature, within its time limits).
Don't want to build the queue yourself? The kit is a self-hosted Cloudflare Worker relay that verifies the Stripe signature, stores the event, answers right away, and retries delivery to your server with backoff. The guide covers every common Stripe webhook failure with copy-paste fixes.
Fix Your Stripe Webhooks guide · Self-Hosted Webhook Relay Kit. Code LAUNCH40 = 40% off until Sun Oct 11, 6:40 AM MT.
In live mode, Stripe retries failed deliveries with exponential backoff for up to three days. Sandbox events are retried only three times over a few hours. Retries stop if the endpoint is disabled or deleted. To catch up faster, list missed events with GET /v1/events?delivery_success=false, process them idempotently, and return 2xx when the retries arrive. Manually resending an event doesn't cancel Stripe's automatic retries.
Retries mean duplicates, so see handling duplicate Stripe events.
Free download: Webhook debugging cheat sheet.
Don't want to build the queue yourself? The self-hosted relay kit ($19) is a Cloudflare Worker that verifies the Stripe signature, queues the event and replies right away, then retries, replays or dead-letters each delivery to your server.
All five common causes with copy-paste fixes: Fix Your Stripe Webhooks guide ($9). Retries, replay and a dead-letter list in front of your endpoint: the self-hosted relay kit ($19).