Skip to content
NEWMeet Alaaddin, your AI genie with a voice. trig8n launches 1 January 2027. See what is new

Library / Finance, Invoices & Accounting

Finance, Invoices & Accounting

Run bounded Lago dunning retries with Data Tables and SMTP alerts

Runs on verified Lago payment events to retry failed payments up to three times, log each outcome in a Data Table, and send SMTP alerts for review, customer action or recovery.

What it does

## Run bounded dunning for failed payments with Lago and email alerts ### How it works This workflow reacts to verified Lago payment events and routes failed payments, customer-action requests, recoveries, and unrelated events. It enriches failed invoices with customer data, retries payment only while a durable three-attempt limit permits, stores every outcome in an n8n Data Table, and sends a configurable billing alert for retries, manual review, customer action, or recovery. ### Setup steps - Add a Lago API credential to the trigger and every Lago action node. - Add an SMTP credential to Send Billing Alert, then replace both example email addresses. - Select the Lago Dunning State table in every Data Table node. It needs the string fields invoice_id, invoice_number, external_customer_id, customer_email, event_type, payment_status, state, and last_action; number fields retry_count and total_amount_cents; and date field last_event_at. - Test the retry, manual-review, customer-action, recovery, and ignored-event paths before publishing. ### Customization Change maxRetries in Decide Whether To Retry, replace email with Slack or PagerDuty, or add human approval for high-value invoices. If Lago Dunning Campaigns already retry these invoices, disable Retry Failed Payment and use this workflow only for state tracking and alerts.

The steps

  1. When Lago Reports a Payment Event
  2. Normalize Billing Event
  3. Route Billing Event
  4. Get Failed Invoice
  5. Get Billing Customer
  6. Load Retry State
  7. Decide Whether To Retry
  8. If Retry Limit Allows
  9. Retry Failed Payment
  10. Build Retry State
  11. Save Retry State
  12. Prepare Retry Alert
  13. Send Billing Alert
  14. Build Manual Review State

25 steps in total.

Similar automations