Back to Blog
n8nautomationtutorialautomatestripepayments

Automate Stripe with n8n: Payments, Subscriptions & Invoice Workflows

n8nautomation.cloud TeamMarch 19, 2026

Introduction

Automating Stripe payments with n8n opens up a world of possibilities for businesses looking to streamline financial operations. Whether you're managing one-time payments, recurring subscriptions, or need to handle failed transactions and invoices, n8n provides a flexible platform to build robust workflows. This tutorial will guide you through creating automation workflows for key Stripe use cases: payment notifications, subscription management, failed payment recovery, and invoice automation. By the end, you'll have a complete system that integrates seamlessly with Stripe's API, minimizing manual work and reducing errors.

Prerequisites

Before diving into the workflows, ensure you have the following:

  • An n8n instance: You can use n8nautomation.cloud for a reliable managed hosting solution, which simplifies setup and scalability.
  • Stripe API keys: A live Stripe account with test or live API keys (test keys are recommended for initial setup).
  • Basic n8n knowledge: Familiarity with nodes, triggers, and data mapping in n8n.
  • Webhook URL (optional): If you need to trigger workflows from external systems, you'll need a URL to receive events.

Step 1: Setting Up the Stripe Node

What to Do

Begin by adding the Stripe node to your workflow. This node acts as the bridge between your n8n workflow and Stripe's API, allowing you to send and receive data.

Where to Click/Configure

In the n8n editor, drag and drop the stripe-node from the node library into your canvas. Click the node to open its configuration panel.

What Values to Enter

  1. API Key: Enter your Stripe secret key. This is a sensitive piece of information, so ensure it's stored securely. Use n8n's secret management if available.
  2. Environment: Select "test" for testing purposes or "live" for production. Always test with test keys first.
  3. Events to Listen For: Choose the Stripe events you want to trigger actions. For payment notifications, select "payment.succeeded" and "payment.failed".

Step 2: Creating a Payment Notification Workflow

What to Do

This step sets up a workflow that listens for Stripe payment events and responds accordingly, such as sending a confirmation email or updating a database.

Where to Click/Configure

After configuring the Stripe node, add a webhook-receiver node (or a manual-trigger if you're simulating events). Connect the Stripe node's output to this node to process incoming events.

What Values to Enter

  • Webhook URL: If using a webhook, paste the URL where Stripe will send events. If using a manual trigger, skip this step.
  • Event Mapping: Map the incoming event data to the Stripe node's parameters. For example, map "payment.id" to a variable for tracking.
  • Action Logic: Add a change-node to format the data or a send-http-request to notify your team via email or Slack.

Step 3: Automating Subscription Management

What to Do

Subscriptions require handling recurring billing, upgrades, or cancellations. n8n can automate these processes by interacting with Stripe's subscription API.

Where to Click/Configure

Add the stripe-node again, but this time select the "subscriptions" module. Connect it to your previous workflow nodes.

What Values to Enter

  • Subscription Events: Choose events like "subscription.created", "subscription.updated", or "subscription.deleted".
  • Customer ID Mapping: Ensure the customer ID from Stripe is correctly passed to n8n for tracking.
  • Action Logic: Use a filter-node to trigger actions based on subscription status (e.g., send a renewal reminder if a subscription is about to expire).

Step 4: Handling Failed Payments

What to Do

Failed payments need immediate attention. This workflow will detect failed transactions and initiate recovery actions, such as retrying the payment or notifying the customer.

Where to Click/Configure

Use the Stripe node's "payment.failed" event trigger. Connect it to a filter-node to check the failure reason (e.g., card declined, insufficient funds).

What Values to Enter

  • Filter Conditions: Set rules like "amount > 0" or "failure_code = 'card_declined'".
  • Recovery Actions: Add a retry-payment node (if available) or a send-email node to inform the customer of the issue.
  • Logging: Use a log-node to record failed payments for later analysis.

Step 5: Automating Invoice Generation

What to Do

Invoices can be generated automatically when a payment is made or a subscription is created. This reduces manual work and ensures accuracy.

Where to Click/Configure

Add the stripe-node and select the "invoices" module. Connect it to your payment or subscription workflows.

What Values to Enter

  • Invoice Settings: Define the invoice's description, line items, and due date. Use variables from previous nodes for dynamic data.
  • Email Notifications: Configure Stripe to send invoices to the customer automatically or use a send-email node in n8n.
  • Data Mapping: Map fields like "customer.email" and "amount" to the invoice template.

Testing Your Workflow

Before deploying, thoroughly test each part of your workflow. Use n8n's test mode to simulate events without affecting real data. For example:

  • Trigger a "payment.succeeded" event manually to see if the confirmation email sends.
  • Simulate a "payment.failed" event to check if the recovery workflow activates.
  • Verify that invoices are generated correctly with the right customer details.

Check the n8n logs for errors. If a step fails, revisit its configuration. For instance, if the Stripe node isn't receiving events, ensure the webhook URL is correct or the event types match.

Common Issues & Troubleshooting

API Key Not Working

If the Stripe node isn't functioning, double-check the API key. Ensure it's a secret key with the correct permissions (e.g., "payments:read", "subscriptions:read"). Test keys are often easier to debug than live keys.

Webhook Not Receiving Events

If Stripe isn't sending data to your webhook, verify the URL is correct. Use tools like ngrok to expose a local server for testing. Also, check Stripe's webhook settings to ensure the secret key matches n8n's.

Field Mapping Errors

Incorrect field mappings can cause data to be lost or misrouted. Use n8n's "inspect" feature to view incoming data from Stripe. Compare the keys (e.g., "payment.id") with what your nodes expect.

Failed Payment Recovery Not Triggering

Ensure your filter conditions are specific enough. For example, if a payment fails due to "card_expired", your filter should check for that exact code. Also, confirm that the retry action is properly configured.

Conclusion

By following this tutorial, you've built a powerful automation system for Stripe payments, subscriptions, failed payments, and invoices. n8n's flexibility allows you to customize workflows to fit your business needs. For a hassle-free experience, consider hosting your n8n instance on n8nautomation.cloud, a reliable managed service that handles infrastructure, scaling, and maintenance. This ensures your automation runs smoothly without the overhead of self-managing servers. Start automating today and focus on what matters most—growing your business.

Ready to automate with n8n?

Get affordable managed n8n hosting with 24/7 support.