n8n Stripe Automation: Beyond Payment Notifications
n8n Stripe automation that handles the full event surface: failed-payment dunning, churn, and disputes with signature verification and CRM routing. Full guide.
Most Stripe Integrations Listen for One Event
The typical Stripe-and-n8n tutorial wires up payment_succeeded, posts a celebratory Slack message, and stops. That covers the happy path and ignores every event that actually costs you money: the failed charge that quietly churns a customer, the subscription cancellation nobody followed up on, the dispute that needed a response within days.
n8n Stripe automation done properly listens to the whole event surface. A single verified webhook receives every Stripe event, a Switch routes each type to its own handler, and failed payments, churn, and disputes each trigger a real response instead of falling through.
And before any of that: verify the signature. An unverified webhook endpoint is a hole anyone can post forged payment events into.
What You Can Automate
- Failed-payment dunning: catch
invoice.payment_failed, email the customer, retry, escalate - Churn response: a
customer.subscription.deletedevent triggers a winback sequence and a CRM flag - Dispute alerts: a
charge.dispute.createdevent pings the team fast, while there's still time to respond - New-customer onboarding:
checkout.session.completedkicks off provisioning and a welcome flow - CRM sync: every relevant event updates the customer record in HubSpot or your database
- Signature verification: every inbound webhook checked against the endpoint secret before processing
The Stripe Event Pipeline
One endpoint in, many handlers out:
Webhook (Stripe events, raw body)
→ Code (verify Stripe-Signature HMAC, stop if invalid)
→ Switch (route on event.type)
→ invoice.payment_failed → dunning branch
→ customer.subscription.deleted → churn branch
→ charge.dispute.created → dispute alert
→ checkout.session.completed → onboarding branch
→ HubSpot / Postgres (update customer record)
Verify first, route second, act third. The verification node is non-negotiable, and it has to come before anything reads the payload as trusted.
1. Receive
A single Webhook node receives all Stripe events. Configure one Stripe endpoint pointing at it and subscribe to the events you handle. One endpoint is easier to secure and reason about than five, and the Switch sorts them out downstream.
2. Verify the signature
This is the step that separates a real integration from a liability. Stripe signs each payload; the Stripe-Signature header carries a timestamp and an HMAC-SHA256 of the raw body using your endpoint secret. A Code node recomputes it and compares:
const crypto = require('crypto');
const sig = $('Webhook').first().json.headers['stripe-signature'];
const raw = $('Webhook').first().json.body; // raw string body
const secret = $env.STRIPE_WEBHOOK_SECRET;
const parts = Object.fromEntries(sig.split(',').map(p => p.split('=')));
const expected = crypto
.createHmac('sha256', secret)
.update(`${parts.t}.${raw}`)
.digest('hex');
if (expected !== parts.v1) {
throw new Error('Invalid Stripe signature');
}
return $input.all();
The Webhook node has to pass the raw body for this to work, because re-serialized JSON won't hash to the same value. That mismatch is the single most common reason verification "randomly" fails.
3. Route by event type
A Switch node keyed on event.type sends each event to its handler. Keeping payment_failed, subscription.deleted, and dispute.created in separate branches means each gets logic suited to it, and the execution log shows exactly which path a given event took.
4. Act per event
The dunning branch emails the customer and schedules a retry. The churn branch starts a winback and flags the CRM. The dispute branch alerts the team immediately, because Stripe gives you a limited window to submit evidence and a missed dispute is lost revenue plus a fee.
5. Sync the record
Whatever the event, update the customer's record so support and sales see current billing state. A failed payment that isn't visible in the CRM means a rep upsells a customer whose card just declined.
Implementation Patterns
Pattern 1 — Verify before you trust, always. The unverified webhook is the most common Stripe-in-n8n security mistake. Anyone who learns the URL can POST a fake payment_succeeded and trip whatever it triggers. The HMAC check is ten lines and belongs before the Switch, every time, no exceptions. The execution log won't warn you it's missing; the forged event just sails through.
Pattern 2 — Dunning is a sequence, not a single email. A failed payment isn't a one-shot notification. It's retry the card, email the customer, wait, retry, escalate, then suspend. Self-hosted n8n runs that multi-day sequence for free, where a per-task tool would meter every step of every dunning cycle across your whole customer base.
Pattern 3 — Idempotent handlers. Stripe will occasionally deliver the same event twice; that's expected behavior, not a bug. Store processed event IDs and skip duplicates, or your dunning branch emails the customer twice for one failure. Dedupe on Stripe's event.id, which is stable across redeliveries.
n8n Nodes You'll Use Most
| Node | Purpose |
|---|---|
| Webhook | Receives all Stripe events at one endpoint |
| Code | Verifies the signature, dedupes on event ID |
| Switch | Routes events by event.type |
| Gmail / SendGrid | Sends dunning and winback emails |
| HubSpot / Postgres | Syncs the customer's billing state |
| Slack | Alerts the team on disputes and high-value churn |
| Wait | Spaces out the retry steps in a dunning sequence |
Getting Started
- Add a Webhook node and configure it to expose the raw request body.
- Create a Stripe webhook endpoint in the dashboard pointing at the n8n URL.
- Store the endpoint secret as an environment variable and build the verification Code node.
- Send a Stripe test event and confirm verification passes for real ones and rejects a tampered one.
- Add the Switch and one branch at a time, starting with
invoice.payment_failed. - Wire the CRM sync and the Slack dispute alert.
- Add event-ID dedupe before going live so redeliveries don't double-fire.
For the subscription side specifically, the Smart Subscription Manager ships the verified-webhook intake with the failed-payment and cancellation branches already wired, so you connect Stripe and your CRM instead of building the event router from scratch.
See the Smart Subscription Manager →The Smart Subscription Manager template ships this end-to-end: the Stripe Webhook intake with signature verification, the Switch that routes payment failures and cancellations, the dunning sequence, and the CRM sync already wired. It's part of The Complete n8n Templates Bundle, a one-time lifetime license to the whole catalog (plus every template added later) if you run more than one of these subscription automations.
Failed payments are also a churn signal, so pair this with n8n subscription churn prevention for the winback side of the dunning branch. The mechanics of receiving and securing inbound events generalize beyond Stripe; the n8n webhook automation guide covers the verification pattern for any provider. The Smart Subscription Manager ties the billing events to the retention playbook in one workflow.
Browse the full template catalog →Common questions
How do I connect Stripe webhooks to n8n?
How do I verify a Stripe webhook signature in n8n?
Can n8n handle failed Stripe payments automatically?
Get the workflow templates this guide is built on
Import-ready n8n JSON, step-by-step setup, and tested end-to-end. One-time payment, own it forever.
Get 3 tested n8n templates, free
The full customer package for three real catalog templates — workflow JSON, step-by-step setup guide, credential checklist. Built through the same live-instance release process as everything we sell. Plus new templates and automation guides in your inbox. No spam, unsubscribe anytime.
- 01Smart To-Do List ManagerPre-built n8n workflow template that automates productivity with OpenAI. Live in about 10 minutes.$14
- 02Email Follow-Up AutomatorPre-built n8n workflow template that automates crm with OpenAI. Live in about 15 minutes.$12
- 03Market Trend AnalyzerPre-built n8n workflow template that automates data processing with OpenAI. Live in about 10 minutes.$14
More automation guides

n8n Backup Automation That Actually Verifies the Backup
A Backup You Never Verified Is a Coin Flip Every n8n backup automation tutorial that ranks does the same thing: schedule an export, push the JSON to Google Drive or S3, done. They back up the data and…

How to Build an n8n Log Alerting Workflow (No Grafana Required)
Most n8n Error Setups Tell You Everything, Which Means They Tell You Nothing An n8n log alerting workflow has one job: surface the failures that need a human and quietly file the ones that don't. The…

n8n Uptime Monitoring with Slack Alerts (Without the Alert Storms)
An Uptime Check That Cries Wolf Gets Muted in a Week The point of n8n uptime monitoring with Slack alerts isn't to detect a single outage. It's to be trusted the next hundred times it fires. Most of t…