n8n Stripe Automation: Subscriptions, Invoices, and Churn Prevention
If you run a SaaS or any subscription-based business, Stripe is likely the backbone of your revenue. But managing payments manually — checking for failed charges, following up on cancellations, syncing subscription data across your tools — is a time sink that scales with your customer base.
I am Javier, a startup consultant in Chile, and I have built Stripe automations for over a dozen SaaS companies using n8n. The impact is always immediate: fewer missed payments, faster response to churn signals, and finance teams that spend their time analyzing revenue instead of chasing invoices.
In this guide, I will show you the Stripe automations that deliver the highest ROI, with practical implementation details for each one.
Why Automate Stripe with n8n?
Stripe has excellent developer tools and a powerful dashboard, but it does not handle cross-tool orchestration well. When a subscription is cancelled, you probably want to trigger actions in your CRM, email platform, support system, and internal communication tools simultaneously. Stripe alone cannot do that.
n8n bridges this gap:
– React to Stripe events in real time — webhooks for payment success, failure, subscription changes, disputes, and more
– Connect Stripe to your entire stack — CRMs, email tools, databases, Slack, and 300+ other integrations
– Build complex payment logic — retry strategies, dunning sequences, upgrade/downgrade handling
– No code required — visual workflows that your non-technical finance team can understand and modify
– Self-hostable — keep sensitive payment data within your own infrastructure
Setting Up n8n with Stripe
Getting started requires a Stripe API key and a webhook connection.
If you do not have n8n running yet, n8n cloud is the fastest path. You will have a working instance in minutes with HTTPS already configured, which Stripe requires for webhooks.
Step 1: Get Your Stripe API Key
1. Log in to your Stripe dashboard
2. Go to Developers > API keys
3. Copy your Secret key (use the test key first: sk_test_...)
4. For production, use the live key (sk_live_...)
Important: never use your publishable key in n8n. You need the secret key for server-side operations.
Step 2: Add Stripe Credentials in n8n
1. In n8n, go to Credentials > Add Credential
2. Search for Stripe API
3. Paste your secret key
4. Test the connection
Step 3: Configure Stripe Webhooks
For real-time event processing, set up the Stripe Trigger node:
1. Add a Stripe Trigger node to a new workflow
2. Select your Stripe credential
3. Choose the events you want to listen to. I recommend starting with:
– invoice.payment_succeeded
– invoice.payment_failed
– customer.subscription.updated
– customer.subscription.deleted
– charge.dispute.created
4. Activate the workflow — n8n registers the webhook with Stripe automatically
You can verify the webhook is registered by checking Developers > Webhooks in your Stripe dashboard.
Workflow 1: Payment Failure Recovery (Dunning)
Failed payments are the number one source of involuntary churn for subscription businesses. This workflow catches failed charges and runs an automated recovery sequence.
How It Works
Trigger: Stripe Trigger on invoice.payment_failed
Step 1: Assess the failure reason. Not all failures are equal. Use a Switch node to route based on the decline code:
– card_declined — the card was rejected by the bank
– insufficient_funds — temporary issue, worth retrying
– expired_card — the customer needs to update their card
– processing_error — Stripe-side issue, retry automatically
Step 2: Customer lookup. Use the Stripe node to fetch the full customer object. Get their email, name, subscription plan, and payment history.
Step 3: Check retry count. Stripe retries failed invoices automatically based on your retry settings, but you want to layer your own communication on top. Use a Function node to check how many times this specific invoice has failed by looking at the attempt_count field.
Step 4: Send targeted communication based on attempt number:
– First failure — Send a friendly email: “Your payment did not go through. This sometimes happens. Here is a link to update your payment method.” Include a direct link to the Stripe customer portal
– Second failure — Send a more urgent email and a Slack DM if you have their Slack information. Mention that their access may be affected
– Third failure — Alert your customer success team via Slack. Create a task in your CRM to call the customer. Consider offering a brief grace period
Step 5: Update your CRM. Flag the account as “payment at risk” in HubSpot, Salesforce, or whatever CRM you use. This gives your sales and success teams visibility.
Results I Have Seen
One SaaS client recovered 34 percent of failed payments in the first month after implementing this workflow. The key was speed — reaching out within minutes of the failure instead of waiting for Stripe’s default retry schedule.
Workflow 2: Subscription Change Alerts
When customers upgrade, downgrade, or cancel, your team needs to know immediately and respond appropriately.
Upgrade Notification
Trigger: Stripe Trigger on customer.subscription.updated
1. Detect upgrade — Compare the previous plan amount with the new plan amount using the previous_attributes field in the webhook payload
2. If upgraded — Send a thank-you email, notify your success team, log the expansion revenue in your reporting database
3. If downgraded — Alert the success team immediately, trigger a feedback survey, and schedule a check-in call
Cancellation Response
Trigger: Stripe Trigger on customer.subscription.deleted
1. Fetch customer data — Get the customer’s full profile, subscription history, and total lifetime value
2. Trigger an exit survey — Send an email with a short survey asking why they cancelled. Use Typeform or Google Forms and connect the responses back to n8n
3. Alert the team — Post a cancellation notice in Slack with the customer name, plan, MRR lost, and how long they were a customer
4. Start a win-back sequence — Wait 7 days, then send a personalized email offering to discuss their concerns. Wait 30 days, then send a special offer if applicable
5. Update reporting — Log the churn event in your analytics database with the reason (if provided from the exit survey)
Workflow 3: Invoice Generation and Distribution
For businesses that need to send formal invoices beyond Stripe’s built-in invoicing, this workflow generates custom PDFs and delivers them.
1. Trigger on invoice finalized — Stripe Trigger on invoice.finalized
2. Fetch line items — Use the Stripe node to get the full invoice with all line items, tax information, and discounts
3. Generate PDF — Use an HTTP Request node to call a PDF generation API (I use a self-hosted solution, but services like PDFMonkey or ApiTemplate.io work well) with your invoice template and the Stripe data
4. Store the invoice — Upload the PDF to Google Drive or S3, organized by customer and date
5. Email the customer — Send the invoice via email with the PDF attached
6. Update your accounting system — Push the invoice data to QuickBooks, Xero, or your accounting platform via their API
Workflow 4: Revenue Reporting Dashboard
A scheduled workflow that compiles your key Stripe metrics every week.
Schedule: Every Monday at 8 AM
Data collection using the Stripe API:
1. MRR calculation — Fetch all active subscriptions and sum the monthly values. Handle annual subscriptions by dividing by 12
2. New MRR — Subscriptions created in the past week
3. Expansion MRR — Upgrades from the past week
4. Churned MRR — Cancellations from the past week
5. Net new MRR — New plus expansion minus churned
6. Failed payment count — Number of failed invoices and total amount at risk
7. Dispute count — Open disputes and their total value
Output: I build this as a Slack message posted to a #revenue channel. The format includes week-over-week comparisons so trends are visible at a glance. For more detailed reporting, push the data to a Google Sheet that feeds into your dashboards.
Workflow 5: Dispute Management
Chargebacks cost you the transaction amount plus a fee, and too many can get your Stripe account flagged. Automate the response process.
Trigger: Stripe Trigger on charge.dispute.created
1. Immediate alert — Post in your #finance Slack channel with the dispute amount, customer name, and reason
2. Gather evidence — Automatically pull the customer’s login history, usage data, and communication records from your systems
3. Create a response draft — Use a template based on the dispute reason (product not received, duplicate charge, fraudulent, etc.) and populate it with the gathered evidence
4. Assign to team member — Create a task in your project management tool with a deadline (you typically have 7-21 days to respond)
5. Track resolution — Listen for charge.dispute.closed events and update your records with the outcome
Advanced Stripe Automation Tips
Handling Webhook Ordering
Stripe does not guarantee webhook delivery order. Your workflows should be idempotent — processing the same event twice should not cause problems. Use the event ID to check if you have already processed an event before taking action.
Test Mode First
Always build and test your workflows with Stripe’s test mode. Use test API keys and the Stripe CLI to trigger test events:
In your terminal, run stripe trigger invoice.payment_failed to simulate a failed payment. This sends a test webhook to your n8n instance.
Handling Currency
If you operate in multiple currencies, make sure your Function nodes handle currency conversion properly. Stripe amounts are in the smallest currency unit (cents for USD, so 1000 equals 10 dollars). Always divide by 100 for display purposes and be aware that some currencies like JPY do not have sub-units.
PCI Compliance
n8n workflows never touch raw credit card numbers — Stripe handles all that. But you should still be careful about what payment data you log or store in other systems. Never store full card numbers, CVVs, or complete card details anywhere outside Stripe.
Start Automating Your Stripe Workflows
The financial health of your subscription business depends on how quickly and consistently you respond to payment events. Manual processes break down as you scale — what works at 100 customers falls apart at 1,000.
Start with the payment failure recovery workflow. It has the most direct revenue impact and will pay for your n8n investment within the first week. Once that is running, layer on the subscription change alerts and revenue reporting.
Ready to build? Get started with n8n and connect your Stripe account today.
Frequently Asked Questions
Is it safe to connect Stripe to n8n?
Yes. n8n connects to Stripe using your secret API key, which is stored encrypted in n8n’s credential system. The connection uses HTTPS, and n8n never handles raw credit card data — Stripe processes all sensitive payment information on their end. If you are using n8n cloud, your data is hosted on secure infrastructure. If you self-host, you control where everything is stored.
Can I use n8n with Stripe Connect for marketplace payments?
Yes. n8n’s Stripe node supports the standard Stripe API, which includes Connect endpoints. You can automate platform-level operations like creating connected accounts, processing transfers, and managing payouts. Use the HTTP Request node for Connect-specific API calls that are not covered by the default Stripe node.
How do I test Stripe automations without affecting real customers?
Use Stripe’s test mode. Create a separate set of n8n credentials with your test API key (starting with sk_test_). Build and activate your workflows with the test credentials. Then use the Stripe dashboard’s test mode or the Stripe CLI to simulate events like payments, failures, and subscription changes. Once everything works correctly in test mode, switch to your live credentials.