Stripe webhook idempotency in Node.js: stop double work
Verify raw webhook bodies first, deduplicate retried deliveries by storing event.id once, and keep side effects separate from Stripe API idempotency keys.
Category Hub · 5 Guides
Most SaaS billing bugs come from treating Stripe API calls and webhooks as fire-and-forget events instead of state transitions backed by a local database ledger. These five primary-sourced guides form one coherent Node.js billing architecture.
event.id storage, then layer on per-seat proration_behavior, usage-based meters, cancel-save flows, and MRR and churn projections.
Verify raw webhook bodies first, deduplicate retried deliveries by storing event.id once, and keep side effects separate from Stripe API idempotency keys.
Maintain a local team-seat ledger before updating subscription item quantities, and pick proration_behavior deliberately so mid-cycle changes never surprise customers.
Record cancellation intent before mutating Stripe, apply reversible save offers, schedule cancel_at_period_end cleanly, and sync reactivations.
Write accepted usage to your own ledger first, forward idempotent Stripe billing meter events from a worker, and trigger customer spend alerts early.
Project active subscription MRR and subscriber churn from an immutable webhook ledger while keeping paid invoice cash and refunds distinct.