Stripe Failed Payment Dunning Sequence Automation - n8n Workflow

Use this comprehensive n8n workflow to automate failed payment recovery. Detect Stripe failures, log details in Google Sheets, and trigger a multi-step dunning sequence using SendinBlue.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • SaaS businesses or e-commerce platforms using Stripe.

  • Revenue operations teams aiming to reduce churn caused by payment failures.

  • Users looking for robust n8n templates that combine real-time events with scheduled follow-up logic.

  • Developers needing an advanced example of a Google Sheets and SendinBlue n8n workflow integration.

Overview

Reducing involuntary churn caused by payment failure is critical for subscription businesses. This powerful n8n workflow provides a complete, hands-off solution for managing the dunning process. Instead of manually monitoring payments or relying solely on Stripe's basic features, this n8n automation captures failed payment events in real-time, logs the necessary customer data into a central Google Sheet, and executes a targeted email recovery sequence. By using a combination of a real-time n8n trigger and a schedule-based n8n trigger, you ensure timely follow-up, maximizing the chance of successful payment recovery. This advanced n8n workflow template demonstrates effective data transformation and conditional logic flow control.

How it Works

This n8n workflow operates in two distinct logical branches, both crucial for payment recovery:

1. Real-time Detection and Logging:


  1. Detect Failed Payments: The process starts with the Stripe n8n trigger configured to listen specifically for failed payment events (charge.failed).

  2. Extract User and Payment Info: The incoming data is cleaned and standardized using a Set n8n node, ensuring only relevant customer and transaction IDs are retained.

  3. Remove Duplicates: A crucial step utilizing the Remove Duplicates n8n node ensures that if a webhook fires multiple times for the same transaction failure, the subsequent logging steps only process unique payment attempts.

  4. Append or update row in sheet: The customer's information (Customer ID, Email, Failure Date, and a counter for emails sent) is logged into a designated Google Sheet. This sheet acts as the database for the follow-up sequence.

2. Scheduled Follow-up Sequence:


  1. Schedule Trigger: This second n8n trigger periodically initiates the follow-up process (e.g., daily or every three days).

  2. Get Payment Failure Leads: The workflow queries the Google Sheet created in the first branch, retrieving all leads that still require follow-up emails.

  3. Check for no. of emails sent: A Switch n8n node analyzes the Emails Sent count from the Google Sheet data. This conditional logic routes the lead to the appropriate action.

Case 0 (Send First Email): If 0 emails have been sent, the lead is routed to the SendinBlue n8n node to deliver the initial recovery message. This is followed immediately by the Update Email Count Google Sheets n8n node, marking the lead as 1 email sent.
Case 1 (Send Second Email): If 1 email has been sent, the lead is routed to the SendinBlue n8n node for the final recovery attempt. This is followed by the Quit Sending Emails to these Leads Google Sheets n8n node, marking the lead as 2 (or 'Done').

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON code and paste it into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. Stripe Trigger Setup: Set up your Stripe credential. Activate the Detect Failed Payments n8n trigger and ensure the webhook is configured in your Stripe dashboard to send charge.failed events to the generated n8n webhook URL.

  3. Google Sheets Credential: Configure your Google Sheets n8n node credentials. For the four Google Sheets nodes, specify the correct Spreadsheet ID, Sheet Name, and the columns used for tracking (e.g., Customer ID, Email Count).

  4. SendinBlue (Brevo) Setup: Set up your SendinBlue API key credential. In the Send First Email and Send Second Email n8n nodes, configure the correct template IDs used for your dunning sequence emails.

  5. Activation: Once credentials are set and configurations match your tracking sheet structure, activate the entire n8n workflow template.

Node Details

Detect Failed Payments (Stripe Trigger n8n trigger):
Function: Serves as the real-time n8n trigger, initiating the process immediately upon a failed Stripe charge event.
Key Configuration: Listens for the charge.failed event type.
Extract User and Payment Info (Set n8n node):
Function: Standardizes the complex Stripe payload into a simple structure containing only the necessary fields (e.g., Customer Email, Invoice ID).
Append or update row in sheet (Google Sheets n8n node):
Function: The central database operation. It logs the new failure event into the designated spreadsheet, often using the 'Append or update' operation to handle repeated failures gracefully.
Schedule Trigger (n8n trigger):
Function: Initiates the follow-up sequence periodically (e.g., set to run every 24 or 48 hours).
Check for no. of emails sent (Switch n8n node):
Function: Core flow control mechanism. It checks the Email Count column value retrieved from Google Sheets and routes the item down the path corresponding to the next email step.
Send First Email / Send Second Email (SendinBlue n8n node):
Function: Uses SendinBlue templates to send personalized dunning emails to the failed payment leads.
Key Configuration: Requires specific SendinBlue template IDs for 'First Email' and 'Second Email' content.
Update Email Count / Quit Sending Emails... (Google Sheets n8n node):
Function: Manages state within the Google Sheet, incrementing the counter after a successful email delivery to ensure the logic flows correctly during the next scheduled n8n workflow execution.

Related n8n Workflows

Paid

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by
iamvaar
iamvaar

Featured*