---
title: "Stripe webhooks failing? Fix subscription drift | Zeroic"
description: "Stripe webhooks failing? Check the signing secret and raw body, return 2xx fast, dedupe event IDs, refetch state and replay missed events from the last 30 days."
url: https://zeroic.in/blog/stripe-webhooks-failing
---

[The Zeroic Journal](https://zeroic.in/blog)

[Software engineering](https://zeroic.in/blog/topic/software-engineering) November 23, 2026 8 min read

# Stripe webhooks failing? Five causes of subscription drift

Why Stripe and your database disagree about who has paid, the five causes we see most, and the handler pattern that keeps access matched to billing.

By Prashant Abbi Partner @ Zeroic

On this page

1. [Stripe webhooks failing: read the status code](#stripe-webhooks-failing-read-the-status-code)
2. [Refetch state instead of trusting events](#refetch-state-instead-of-trusting-events)
3. [Thin events make refetching the default](#thin-events-make-refetching-the-default)
4. [Recover the events you already missed](#recover-the-events-you-already-missed)
5. [How to triage a failing endpoint](#how-to-triage-a-failing-endpoint)
6. [How Prompt Genie gates features on live billing](#how-prompt-genie-gates-features-on-live-billing)

On this page 6 sections

1. [Stripe webhooks failing: read the status code](#stripe-webhooks-failing-read-the-status-code)
2. [Refetch state instead of trusting events](#refetch-state-instead-of-trusting-events)
3. [Thin events make refetching the default](#thin-events-make-refetching-the-default)
4. [Recover the events you already missed](#recover-the-events-you-already-missed)
5. [How to triage a failing endpoint](#how-to-triage-a-failing-endpoint)
6. [How Prompt Genie gates features on live billing](#how-prompt-genie-gates-features-on-live-billing)

Stripe webhooks failing usually comes down to five things: the wrong signing secret, a parsed request body, a handler too slow to answer, no duplicate check, or code that trusts event order. Stripe retries live-mode deliveries for up to 3 days, so fix the endpoint first, then refetch subscription state and replay what you missed.

The symptom founders notice is rarely the webhook itself. It’s a customer who paid and still sees the free plan, or one whose card failed two weeks ago and still has every premium feature. Both mean the same thing: your database and Stripe disagree, and nothing told you. A broken endpoint also costs revenue directly, since Stripe holds back renewal invoices when it can’t reach you.

## Stripe webhooks failing: read the status code

Start in Workbench. Open the endpoint under **Webhooks**, then the **Event deliveries** tab, and read the status code on a failed attempt. [Stripe’s webhook docs](https://docs.stripe.com/webhooks) map each one to a cause:

- **3xx:** Stripe treats a redirect as a failure. A `www` redirect or an HTTP-to-HTTPS hop is enough. Register the final URL.
- **401, 403 or 405:** something in front of your route is refusing the request. Auth middleware, a CSRF check, bot protection on your host, or a route that doesn’t accept POST.
- **404:** the URL is wrong, often a preview deployment URL left in the Dashboard after launch.
- **500:** your handler threw. The fix is in your logs.
- **Timeout:** the handler did slow work before answering. Stripe says to return a `2xx` before any complex logic.

A `400` often means your own handler rejected the event because signature verification failed. That failure has two sources.

**The wrong secret.** [Stripe’s signature troubleshooting page](https://docs.stripe.com/webhooks/signature) calls this the most common cause. Every endpoint has its own `whsec_` secret, test and live mode have different ones, and the secret `stripe listen` prints locally is not the Dashboard endpoint’s secret. An app that works on your laptop and fails in production has usually shipped the CLI secret.

**A modified body.** Stripe signs the exact raw bytes it sent. If your framework parses JSON first and you verify against a re-serialized object, the check fails every time. In a Next.js App Router route, read `await req.text()`, never `req.json()`. In the Pages Router, disable the body parser. In Express, register the webhook route before `app.use(express.json())`.

Two newer details help here. Some deliveries now carry debug entries in the `Stripe-Signature` header: a redacted `secret`, the `destination` endpoint ID and a `payload` digest suffix. Compare the redacted secret with yours to spot a mismatch, and the digest to see whether your code changed the body. Stripe is explicit that these entries aren’t signed, so never use them to authenticate anything. And the SDKs reject signatures older than a default tolerance of 5 minutes, so a server with a drifting clock fails too. Don’t set the tolerance to 0; that disables the recency check entirely.

## Refetch state instead of trusting events

Fixing delivery stops new failures. It doesn’t explain why billing drifts on an endpoint that returns `200` every time. That drift comes from handler logic, and Stripe’s docs name the three causes.

**Events arrive out of order.** Stripe doesn’t guarantee delivery order. Creating one subscription can produce `customer.subscription.created`, `invoice.created`, `invoice.paid` and `charge.created`, in any order. You also can’t sort by the event’s `created` field: it’s recorded in seconds, so distinct events can share a timestamp.

**Events arrive twice.** Stripe says endpoints occasionally receive the same event more than once, and sometimes it generates two separate Event objects for one change. Dedupe on the event ID, and for the second case, on the object ID in `data.object` plus the event type.

**Payloads go stale.** A snapshot event carries the object as it was when the event was created. [Stripe’s events guide](https://docs.stripe.com/events/how-events-work) warns that it “might be outdated by the time you process the event”.

A handler that applies each event as a patch (“set status to past_due”) breaks on all three. Stripe sends `customer.subscription.updated` for every plan change, so an upgrade followed quickly by a downgrade produces two of them; apply them in reverse and the customer ends up on the plan they just left. The pattern that holds:

1. Verify the signature against the raw body.
2. Insert the event ID into a table with a unique constraint. If the insert conflicts, return `200` and stop.
3. Return `200`. The event is now stored durably, so nothing is lost if the worker crashes.
4. In a background worker, fetch the current subscription from the API and overwrite your row with it.

```
// app/api/stripe/webhook/route.ts export async function POST(req: Request) { const body = await req.text(); // raw bytes, never req.json() const sig = req.headers.get("stripe-signature")!; let event; try { event = stripe.webhooks.constructEvent(body, sig, process.env.STRIPE_WEBHOOK_SECRET!); } catch { return new Response("bad signature", { status: 400 }); } // unique constraint on event_id: a duplicate insert is a no-op await db.stripeEvents.insertIgnore({ eventId: event.id, type: event.type, payload: body }); return new Response("ok", { status: 200 }); // a worker refetches and applies state }
```

Step 4 is what makes order irrelevant. Whether `invoice.paid` or `customer.subscription.updated` lands first, the worker writes whatever Stripe says now, so the last write is always current. Stripe’s subscription guide makes the same point for renewals: after `invoice.paid`, retrieve the subscription and confirm it’s `active` before extending access. Grant access at `active` or `trialing`, warn at `past_due`, and revoke at `canceled` or `unpaid`.

The queue matters at scale too. Stripe recommends processing events asynchronously because delivery spikes, such as the start of a month when subscriptions renew, can overwhelm a synchronous endpoint. A [stripe.dev post on reconciliation patterns](https://stripe.dev/blog/database-reconciliation-growing-businesses-part-2) adds a dead-letter queue, so events that keep failing wait for a human instead of disappearing.

One event needs a fast answer of its own: `invoice.created`. If Stripe doesn’t get a successful response to it, [the subscription webhook guide](https://docs.stripe.com/billing/subscriptions/webhooks) says it delays finalizing automatically collected invoices for up to 72 hours. A dead endpoint during renewal week holds back the money as well as the data.

## Thin events make refetching the default

Stripe has moved its own defaults toward this pattern. The Dashboard now offers two payload formats when you create an event destination, and labels **Thin** as recommended. A thin event carries only the event type, ID, timestamp and a reference to the related object, so your code has to fetch current state. That’s the step most broken handlers skip.

Two recent releases make thin events usable for subscriptions:

- **2026-09-30.endive** made [thin events for API v1 resources generally available](https://docs.stripe.com/changelog/endive/2026-09-30/thin-events-for-api-v1-resources-generally-available). Subscribe to `v1.customer.subscription.updated` instead of `customer.subscription.updated`.
- **2026-10-28.endive** added about 50 semantic thin events, including `v1.customer.subscription.active`, `v1.customer.subscription.past_due` and `v1.customer.subscription.item_price_changed`. Instead of filtering every `updated` event for a status change, you subscribe to the milestone itself.

Stripe’s changelog says existing integrations don’t need changes, so this isn’t a forced migration. Thin events also aren’t versioned, which removes one more source of breakage: a snapshot destination’s payload is pinned to an API version, and in statically typed SDKs a version mismatch causes deserialization failures. If you’re rebuilding a broken handler anyway, build it on thin events. Note that thin events need their own endpoint, and an account can register at most 16 event destinations.

## Recover the events you already missed

Once the endpoint works, backfill. Stripe’s guide to [processing undelivered events](https://docs.stripe.com/webhooks/handle-irrecoverable-events) gives the steps:

- Call the List Events API with `delivery_success=false`, the event types you handle, and `ending_before` set to the last event delivered before the outage. It returns events from the last 30 days only.
- Run each event through the same dedupe check as live traffic. Stripe keeps retrying events you’ve processed by hand, so your endpoint must return `200` for ones already handled.
- For single events, the Dashboard’s **Resend** works for up to 15 days after creation, and `stripe events resend` in the CLI for up to 30.

Past 30 days, events can’t be resent and their payloads are truncated. For anything older, rebuild state directly: list your active subscriptions from the API and overwrite your table.

Turn that rebuild into a nightly job. It compares every subscription in your database with Stripe and fixes mismatches. It catches the failures your handler can’t see, including the rare case where Stripe fails to generate an event at all; Stripe now reports those through a `v2.core.health.event_generation_failure.resolved` event, in public preview, and tells you to poll the affected resource. Some teams argue for polling instead of webhooks. Stripe’s subscription docs disagree: a subscription integration needs a webhook destination because most subscription activity happens asynchronously. Webhooks give you speed; reconciliation gives you correctness. You want both.

If your Stripe data already lives in Supabase, our guide to [Stripe subscriptions with Supabase](https://zeroic.in/blog/stripe-subscriptions-supabase) compares the Sync Engine and Data Pipeline, which run this sync for you.

## How to triage a failing endpoint

- **Status 3xx, 404 or 405:** URL or routing. Register the final production URL and allow POST.
- **Status 400 with a signature error:** compare the secret in your environment with the endpoint’s, then check that nothing parses the body first.
- **Timeouts:** store the event and return `200`. Move all processing to a worker.
- **Every delivery returns 200 but access is wrong:** handler logic. Add event ID dedupe and refetch the subscription before writing.
- **Renewal invoices stuck in draft:** your endpoint isn’t answering `invoice.created`. Fix it before the 72-hour delay runs out.
- **The outage lasted days:** replay from the List Events API, then run a full reconciliation against the subscriptions list.
- **Rebuilding the handler from scratch:** use a thin event destination and subscribe to the semantic subscription events.

In billing code generated by Lovable or Bolt, the dedupe and refetch steps are the ones we most often find missing. Our page on [fixing apps by builder tool](https://zeroic.in/code-rescue-by-tool) covers the other gaps we find, and [Code Rescue](https://zeroic.in/services/code-rescue) is how we close them in an existing codebase.

## How Prompt Genie gates features on live billing

[Prompt Genie](https://zeroic.in/prompt-genie) is a prompt library for teams with monthly and annual Stripe plans. We built its web app and its subscriptions: checkout with Stripe Elements, plus upgrades, downgrades, cancellations and proration handled through webhooks.

Plan changes are where drift starts in any subscription app, because one customer action produces several events in quick succession. The safeguard we built was to turn premium features on and off from the live subscription state, so access follows what Stripe reports rather than a flag set once at checkout. The same discipline applies to money moving the other way: for [Artswrk](https://zeroic.in/artswrk) we built Stripe Connect escrow, covered in our guide to [marketplace escrow with Stripe Connect](https://zeroic.in/blog/marketplace-escrow-payments-stripe-connect).

If you’d rather have engineers who already know this stack working inside your team, our page on [hiring Next.js and Supabase developers](https://zeroic.in/developers) covers that route.

## Frequently asked questions

**Why does Stripe say my webhook endpoint is failing?**

Stripe marks a delivery as failed when your endpoint doesn't return a 2xx status in time. The usual causes are a redirect, which Stripe treats as a failure, a 401, 403 or 405 from auth or routing, a 404 from a wrong URL, a 500 from your handler, a TLS problem, or a timeout from doing slow work before responding. The Event deliveries tab in Workbench shows the status code for each attempt.

**How long does Stripe retry failed webhooks?**

In live mode, Stripe retries a failed delivery for up to three days with exponential backoff. In a sandbox it retries three times over a few hours. After that you can resend an event from the Dashboard for up to 15 days, or with the Stripe CLI for up to 30 days, and the List Events API returns events from the last 30 days.

**Why does Stripe webhook signature verification work locally but fail in production?**

Usually because production uses a different signing secret. The secret the Stripe CLI prints for stripe listen differs from the Dashboard endpoint's secret, and test and live mode have separate secrets too. The other common cause is a framework that parses the request body before verification. Stripe signs the exact raw bytes, so any parsing or re-serializing breaks the check.

**Do Stripe webhooks arrive in order?**

No. Stripe's docs say it doesn't guarantee delivery in the order events were generated, so invoice.paid can arrive before customer.subscription.created. Don't use the event's created timestamp to order them either, because it's recorded in seconds and distinct events can share one. Treat each event as a signal, fetch the current subscription from the API, and write that state.

**Can I poll the Stripe API instead of using webhooks for subscriptions?**

Not as your only mechanism. Stripe's subscription docs say a subscription integration needs a destination that handles webhook events, because most subscription activity happens asynchronously, and a missed invoice.created response delays invoice finalization by up to 72 hours. Use webhooks for timely updates and a scheduled job that compares your table with Stripe as the safety net.

## References

1. [Stripe Docs - Receive Stripe events in your webhook endpoint](https://docs.stripe.com/webhooks)
2. [Stripe Docs - Using webhooks with subscriptions](https://docs.stripe.com/billing/subscriptions/webhooks)
3. [Stripe Docs - Manage webhook endpoints and resolve signature errors](https://docs.stripe.com/webhooks/signature)
4. [Stripe Docs - How events work (thin and snapshot events)](https://docs.stripe.com/events/how-events-work)
5. [Stripe Docs - Process undelivered events](https://docs.stripe.com/webhooks/handle-irrecoverable-events)
6. [Stripe changelog - Thin events for API v1 resources generally available (2026-09-30.endive)](https://docs.stripe.com/changelog/endive/2026-09-30/thin-events-for-api-v1-resources-generally-available)
7. [Stripe changelog - Semantic thin events for subscriptions and invoicing (2026-10-28.endive)](https://docs.stripe.com/changelog/endive/2026-10-28/semantic-thin-events-subscriptions-invoicing-financial-connections)
8. [stripe.dev - Queue-based and event-driven data reconciliation patterns](https://stripe.dev/blog/database-reconciliation-growing-businesses-part-2)

#stripe#webhooks#billing#subscriptions#saas

More from the journal

[ SaaS

## [Stripe subscriptions Supabase setup: sync, usage billing, dunning](https://zeroic.in/blog/stripe-subscriptions-supabase)

Which Stripe primitive fits each pricing model, how to get billing state into Postgres, and the webhook, dunning and tax details that break first.

Prashant Abbi Nov 4, 2026 · 8 min read

[ SaaS

## [Supabase multi tenant RLS: patterns that hold up](https://zeroic.in/blog/supabase-multi-tenant-rls)

Shared schema, schema per tenant or a project per tenant: when each wins on Supabase, what fails first in each, and where the Stripe subscription belongs.

Prashant Abbi Nov 9, 2026 · 8 min read

[ Software engineering Best tools

## [Best apps built with Supabase (2026)](https://zeroic.in/blog/best-apps-built-with-supabase)

Ten live products that say they run on Supabase, from email APIs to compliance tools, grouped by market, and when building your own makes sense.

Prashant Abbi Oct 24, 2026 · 10 tools

## Hear from Prashant within 24 hours.

**Prashant Abbi** Partner @ Zeroic

Is your app's billing out of step with Stripe? Tell us what's drifting. We'll trace the failed deliveries, rebuild the handler around dedupe and refetch, and backfill the events you missed.

Rather talk it through? [Book a 30-minute call](https://zeroic.in/book)

Pages [Services](https://zeroic.in/services) [Work](https://zeroic.in/work) [Blog](https://zeroic.in/blog) [About](https://zeroic.in/about) [Guide for AI](https://zeroic.in/llms.txt)

Services [Audits](https://zeroic.in/services/ai-audit) [MVP Sprint](https://zeroic.in/services/mvp-development) [Retainer](https://zeroic.in/services/senior-developers) [Code Rescue](https://zeroic.in/services/code-rescue) [AI development](https://zeroic.in/ai-development-company) [Fractional CTO](https://zeroic.in/fractional-cto-services)

Solutions [Fix AI-built apps](https://zeroic.in/code-rescue-by-tool) [AI services](https://zeroic.in/ai-services) [Migrations](https://zeroic.in/migrations) [Bubble to code](https://zeroic.in/bubble-to-code) [Build an app like](https://zeroic.in/build-an-app-like)

Industries [Marketplaces](https://zeroic.in/marketplace-app-development) [B2B SaaS](https://zeroic.in/saas-mvp-development) [FinTech](https://zeroic.in/fintech-app-development) [Telehealth](https://zeroic.in/telehealth-app-development) [EdTech](https://zeroic.in/edtech-app-development) [All industries →](https://zeroic.in/industries)

Developers [Bubble](https://zeroic.in/hire-bubble-developers) [React](https://zeroic.in/hire-react-developers) [Python](https://zeroic.in/hire-python-developers) [AI & LLMs](https://zeroic.in/hire-ai-developers) [API integrations](https://zeroic.in/api-integration-services) [All developers →](https://zeroic.in/developers)

Contact [Email](mailto:zeroic.in@gmail.com) [WhatsApp](https://wa.me/919873927225) [LinkedIn](https://www.linkedin.com/company/zeroic/) [X (Twitter)](https://x.com/PrashantAbbi) [Book a call](https://zeroic.in/book)

© 2026 Zeroic [Privacy](https://zeroic.in/privacy) [Terms](https://zeroic.in/terms)

Built in India · Shipping globally

SINCE
