Templates / Run bounded dunning for Lago payment failures with email alerts

Run bounded dunning for Lago payment failures with email alerts

Unknown

by Black Swamp AI ✓ · 0 views · created 2026-08-24 · Invoice Processing

Unknown. This template uses community nodes we can't verify statically. Uses community nodes that can't be verified statically (unverified community packages are off by default in 3.0). Static check, last run 2026-10-19.

Community nodes

These come from third-party npm packages. In n8n 3.0 unverified community packages are off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).

Nodes used (8)

What it does

Quick overview This workflow listens to Lago payment webhooks, retries failed invoice collections up to three times, stores a durable dunning state in an n8n Data Table, and emails billing when a retry is requested, customer action is required, or a payment is recovered. How it works 1. Receives verified and deduplicated payment events from Lago via a webhook trigger. 2. Normalizes the webhook payload to extract the invoice ID, customer identifiers, payment status, and a recommended handling action. 3. For payment failures, fetches the invoice and customer from Lago, loads the current retry count from an n8n Data Table, and retries the invoice payment in Lago when the invoice is still unpaid and the three-attempt cap is not reached. 4. Records the updated dunning state (retry requested or manual review required) in the n8n Data Table and prepares a billing notification message. 5. For events that require customer authentication, preserves the current retry count in the n8n Data Table and prepares an alert that includes the payment action URL. 6. For successful payments, marks the invoice as recovered in the n8n Data Table while retaining the accumulated retry count. 7. Sends a plain-text email to the billing address for retry, manual review, customer action required, and recovery outcomes. Setup 1. Add your Lago API credential to the Lago Trigger and all Lago nodes used to get invoices, get customers, and retry payments. 2. Configure an SMTP credential for the email node and replace the default to/from addresses ([email protected] and [email protected]). 3. Create (or select) an n8n Data Table for “Lago Dunning State” and ensure it includes fields for invoice/customer identifiers, event and payment status, retrycount, state/lastaction, totalamountcents, and lasteventat. 4. Activate the workflow and ensure Lago can deliver webhook events to the trigger’s registered endpoint.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.