- Stripe
Stripe subscription webhooks: which events to handle, and how to handle them safely
· Alex Foong · 11 min read

Stripe subscription webhooks are the events Stripe sends to your server when a subscription starts, changes, renews, fails to pay or ends. Most SaaS apps need six of them: customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, invoice.paid, invoice.payment_failed and customer.subscription.trial_will_end.
This guide maps each event to the question it answers. It then covers the part most guides skip: duplicates, retries, events that arrive out of order, and connected accounts. The examples come from the webhook pipeline Reoffer runs on its customers’ Stripe accounts. Stripe behaviour is linked to Stripe’s docs, as of 30 November 2026.
Which Stripe subscription events matter
Stripe sends an event object for every change. Each one has an id, a type, a created timestamp and the changed object in data.object. For updates, data.previous_attributes holds the fields that changed. Stripe lists the subscription events in its guide to using webhooks with subscriptions.
| Event type | When Stripe sends it | What your app usually does |
|---|---|---|
customer.subscription.created | A subscription is created | Store the subscription id and status. Don’t grant access yet if the status is incomplete. |
customer.subscription.updated | Any change: plan, quantity, status, discount, cancel date, pause | Sync status, price and period end. Read previous_attributes to see what changed. |
customer.subscription.deleted | The subscription has ended | Remove access. This is the final event for that subscription. |
customer.subscription.trial_will_end | Three days before a trial ends | Remind the customer, check they have a payment method. |
customer.subscription.paused / resumed | The subscription status changes to or from paused | Sync the status. |
invoice.created | A renewal invoice is drafted | Add line items if you bill usage. |
invoice.paid | An invoice is paid | Extend access to the new period. |
invoice.payment_failed | A payment attempt fails | Tell the customer, show a link to update the card. |
invoice.payment_action_required | The bank asks for authentication (3D Secure) | Send the customer to complete the payment. |
You don’t need all Stripe events. Subscribe your webhook endpoint only to the event types you handle. Fewer events mean fewer requests to verify, store and ignore. In a typical integration, most deliveries are customer.subscription.updated, because it covers so many kinds of change.
Which webhook fires when a Stripe subscription is created?
customer.subscription.created fires when the subscription object is created, through Checkout, the API or the Dashboard. At that moment the first payment may not have gone through. If the status is incomplete, wait for invoice.paid or a customer.subscription.updated event with status active before you grant access. Checkout users often also handle checkout.session.completed, which links the session to your own user.
Which webhook fires when a Stripe subscription is cancelled?
It depends on how the customer cancels. A cancel at the end of the period sends customer.subscription.updated straight away. In that event cancel_at_period_end turns true and cancel_at holds the end date. The customer keeps access until then. When the period ends, Stripe sends customer.subscription.deleted. An immediate cancel sends customer.subscription.deleted right away and skips the first step.
Is there a webhook when a Stripe subscription expires?
No. Stripe has no customer.subscription.expired event. A subscription that ends on its cancel date sends customer.subscription.deleted. A new subscription whose first invoice stays unpaid for 23 hours moves to status incomplete_expired, per Stripe’s subscriptions overview. You see it as a status change on the subscription, so read status on every update rather than waiting for an “expired” event.
Reading a cancellation from webhooks
Cancellations are where subscription events matter most for revenue. The signal is split across two events, and each needs its own handling.
First, the scheduled cancel. A customer.subscription.updated event with cancel_at_period_end: true means the customer asked to leave. The subscription is still active and still billed for the current period. If the customer cancelled in the Stripe customer portal, cancellation_details.reason is cancellation_requested. The feedback field holds the reason they picked, if you turned the survey on.
Second, the reversal. If the customer changes their mind, another update arrives with cancel_at_period_end: false. This is also what a retention offer does when it works. The offer is applied, and the scheduled cancel is cleared on the same subscription.
Third, the end. customer.subscription.deleted means the subscription is over. Status becomes canceled, and it can’t be restarted. A returning customer needs a new subscription.
For example, a customer on a monthly plan clicks cancel on 10 March, and the period ends on 1 April. You get an update with cancel_at_period_end: true on 10 March. If nothing changes, the delete event arrives on 1 April. That gives you three weeks to show an offer, and one place to check whether it stuck.
Which webhook fires when a Stripe subscription renews?
A renewal has no subscription event of its own. Stripe creates an invoice for the new period, so invoice.created fires first. When Stripe collects automatically and you have webhooks set up, it waits about an hour after invoice.created before it finalizes and charges the invoice. Then invoice.finalized and invoice.paid follow. A customer.subscription.updated event also arrives, because current_period_start and current_period_end move forward. Use invoice.paid as the signal to extend access.
Renewals and failed payments
When the renewal charge fails, Stripe sends invoice.payment_failed. The subscription usually moves to past_due, which arrives as a customer.subscription.updated event. Stripe then retries the payment on the schedule in your Billing settings. After the last retry it cancels the subscription, marks it unpaid or leaves it past due, depending on that setting.
Watch invoice.payment_action_required as well. It means the bank wants the customer to authenticate. A retry won’t fix it, so the customer has to come back and finish the payment.
Failed payments are involuntary churn. A customer who cancels on purpose is voluntary churn, and the two need different tools. Dunning emails and card updates handle the first. A cancel flow with the right offer handles the second. Keep the two event paths apart in your code, so a failed card never triggers a “sorry to see you go” email.
Setting up Stripe webhooks: endpoint and signing secret
A webhook endpoint is a public HTTPS URL on your server that accepts POST requests from Stripe. Setup takes five steps.
- Add the endpoint in the Stripe Dashboard (Developers → Webhooks) or with the API. Select your API version and the event types from the table above.
- Copy the endpoint’s signing secret. It starts with
whsec_. Store it as a server secret, never in client code. - Read the raw request body. Don’t parse it as JSON before you verify it.
- Verify the signature with Stripe’s library, then handle the event.
- Return a 2xx status quickly. Do slow work after the response, not before.
Live mode and test mode have separate endpoints and separate signing secrets. Keep them in separate settings, so a test secret can never verify a live event.
How do I verify a Stripe webhook signature?
Pass the raw body, the Stripe-Signature header and your signing secret to Stripe’s library. In Node.js that is stripe.webhooks.constructEvent(rawBody, signature, secret). It returns the event, or throws if the signature doesn’t match. The header holds a timestamp and an HMAC-SHA256 signature. The libraries also reject events older than a tolerance, five minutes by default, which blocks replays. Details are in Stripe’s webhooks docs. Most failures come from a framework that parsed the body first. Even re-serialised JSON with the same data fails, because the bytes differ.
Duplicates, retries and out-of-order events
Stripe subscription webhooks are delivered at least once, not exactly once. Three things follow from that delivery model, and each one needs code.
Retries. If your endpoint doesn’t return a 2xx, Stripe tries again. In live mode it keeps retrying with growing delays for up to three days, according to its webhooks docs. So a slow or failing handler gets the same event again later.
Duplicates. The same event can arrive twice, even after a 2xx. Store each event id and skip one you have already seen.
Order. Stripe doesn’t promise order. An older customer.subscription.updated can arrive after a newer one. Compare the event’s created time with the last event you applied, or fetch the subscription from the API and use its current state.

A design that handles all three
Here is how Reoffer’s code handles Stripe subscription webhooks on its customers’ accounts. It is a design you can copy.
- Verify, store, answer. The handler reads the raw body and checks the signature. It saves the verified event to the database, then returns
200. If the save fails, it returns500on purpose, so Stripe retries and nothing is lost. - Drop repeats. An event id that is already stored gets a
200and nothing else. - Process later, in batches. A scheduled job claims a batch of stored events with row locks. Two runs can never claim the same event. Each event has a time limit.
- Retry with backoff. Temporary errors, like Stripe rate limits, 5xx answers or database hiccups, are retried. The delay doubles each time, with up to 20% random jitter. After a set number of attempts the event moves to a dead-letter state for a person to check.
- Ignore stale events. An event older than the last one applied to the same record is skipped as stale.
Every handler is idempotent. Running it twice on the same event leaves the same state, so a crash mid-batch never causes a double billing change.
Webhooks on connected accounts (Stripe Connect)
If your platform acts on other businesses’ Stripe accounts, their subscription events don’t reach a normal endpoint. You need a Connect webhook endpoint that listens to events on connected accounts, as Stripe’s Connect webhooks docs describe. Each event then carries an account field with the connected account’s id. Use it to find the right tenant before you touch any data.
Reoffer works this way. Founders connect their Stripe account through Stripe Connect OAuth. Reoffer has one Connect endpoint for live mode and one for test mode. Each verifies against exactly one signing secret, and the platform’s own billing webhooks use a third, separate endpoint.
Testing Stripe subscription webhooks
Test Stripe subscription webhooks in test mode before any live event reaches your code. The Stripe CLI is the fastest way to test locally. Run stripe listen --forward-to localhost:3000/api/webhooks/stripe. The CLI prints a temporary signing secret for your local server and forwards test-mode events to it. In a second terminal, stripe trigger customer.subscription.updated creates the objects and sends the event. See the Stripe CLI docs.
Renewals and trial ends are harder, because they depend on time. Use test clocks: attach a test customer to a clock and move it forward a month. Stripe then sends the real renewal sequence: invoice.created, invoice.paid and the subscription update. To test a failed renewal, give the customer a test card that declines.
Before you go live, check four things:
- A wrong signature returns 400 and changes nothing.
- Sending the same event twice changes the state once.
- An older event sent after a newer one doesn’t roll the state back.
- A database error returns 500, so Stripe retries.
Common mistakes with Stripe webhooks
Most broken integrations fail in the same few ways. Check yours against this list.
- Granting access on
created. A new subscription can beincomplete. Wait for a paid invoice or anactivestatus. - Treating a scheduled cancel as the end.
cancel_at_period_end: truestill means a paying customer. Remove access ondeleted, not before. - Doing slow work before the response. Sending emails or calling other APIs first can push you past Stripe’s timeout. Stripe then retries, and the work runs twice.
- Trusting the payload without checking. An unsigned request to your URL can come from anyone. Verify first, every time.
- Using one secret for live and test. Each endpoint has its own signing secret. Mixing them up makes every event fail verification.
- Sending a notification on every update.
customer.subscription.updatedfires for many small changes. Readprevious_attributesand act only on the fields you care about.
How Reoffer uses subscription webhooks
Reoffer shows a cancelling customer one offer: a percentage discount, a free billing cycle or paused payments. Accepting the offer only shows intent. Reoffer counts a save when Stripe confirms the change, and the webhook is where that confirmation arrives.
When a customer.subscription.updated event comes in, Reoffer compares the subscription’s current state with the accepted offer. Depending on the offer, it checks for the discount on the subscription or pause_collection with the expected resume date, and for a cleared scheduled cancel. The verdict has three values: confirmed, not confirmed, or indeterminate. Only a definite answer changes the record. An indeterminate one waits for a reconciliation job that fetches the subscription from Stripe. The webhook handlers never change billing themselves. They only confirm and sync what Stripe shows.
If you track saves yourself, use the same rule. A click on “accept offer” is not a save. The subscription state in Stripe is. Read more in how to track your cancellation save rate. For the API calls that make these changes, see how to update a Stripe subscription, how to cancel a Stripe subscription and how to pause a Stripe subscription.
Frequently asked questions
Start with customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, invoice.paid and invoice.payment_failed. Add customer.subscription.trial_will_end if you offer trials, and invoice.payment_action_required if your customers’ banks ask for 3D Secure. The updated event carries most changes, including cancel dates, discounts, pauses and status. Subscribe only to the events you handle, so your endpoint verifies and stores fewer requests.
invoice.payment_failed. Stripe sends it each time a charge on a subscription invoice fails. The subscription usually moves to past_due at the same time, which arrives as a customer.subscription.updated event. Stripe then retries on the schedule in your Billing settings. Use the failed event to tell the customer and link to a card update page. Keep this path apart from your voluntary cancel flow.
Use the Stripe CLI. Run stripe listen with –forward-to pointing at your local webhook route, and use the signing secret it prints. Then run stripe trigger customer.subscription.updated, or another event type, in a second terminal. For renewals and trial ends, create a test customer on a test clock and move the clock forward, so Stripe sends the real event sequence.
Yes. Stripe delivers webhooks at least once, so the same event can arrive more than once, and in live mode it retries failed deliveries for up to three days. Store each event id and skip ids you have already processed. Make each handler idempotent, so running it twice leaves the same state. Events can also arrive out of order, so compare their created times.
See why your customers leave
Start on the Free plan: no card, one product, feedback only. Connect Stripe on a paid plan when you want offers applied and saves counted.