Automation library · Money admin

Run bounded dunning for Lago payment failures

Started by an event in a connected app, and works across Email and n8n data table. 25 steps, 2 branches: large, and worth reading before you trust it with anything live.

Large

25 stepsLarge: read it before trusting it with anything live
2Branches: places the flow splits
0Loops or waits
2Services it connects to

The flow

Starts it 1Logic 13Service 11

The steps in the order they run, from what starts it.

  1. 1When Lago Reports a Payment EventLago triggerStarts it
  2. 2Normalize Billing EventCodeLogic
  3. 3Route Billing EventSwitchLogic
  4. 4Get Failed InvoiceLagoService
  5. 5Load Customer Action StateData TableService
  6. 6Load Recovery StateData TableService
  7. 7Record Why the Event Was IgnoredSetLogic
  8. 8Get Billing CustomerLagoService
  9. 9Build Customer Action StateCodeLogic
  10. 10Build Recovered Payment StateCodeLogic
  11. 11Load Retry StateData TableService
  12. 12Save Customer Action StateData TableService
  13. 13Save Recovered Payment StateData TableService
  14. 14Decide Whether To RetryCodeLogic
  15. 15Prepare Customer Action AlertSetLogic
  16. 16Prepare Recovery AlertSetLogic
  17. 17If Retry Limit AllowsIfLogic
  18. 18Send Billing AlertEmail SendService
  19. 19Retry Failed PaymentLagoService
  20. 20Build Manual Review StateCodeLogic
  21. 21Build Retry StateCodeLogic
  22. 22Save Manual Review StateData TableService
  23. 23Save Retry StateData TableService
  24. 24Prepare Manual Review AlertSetLogic
  25. 25Prepare Retry AlertSetLogic

How it's built

Starts on
An event in a connected app
Steps
25, with 2 branches
Size
Large: read it before trusting it with anything live
Connects to
Email, n8n data table
Model
None. This is plumbing, not judgement

Questions

What does it need to run?

An n8n account, plus your own Email account. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an event in a connected app.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Take your time. At 25 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 25 steps before you point it at anything that matters.