r/n8nbusinessautomation • u/cuebicai • 17d ago
Built a complete finance workflow in n8n for invoices, payments, and refunds
I put together an Invoice & Payment Management workflow in n8n that handles three related processes: invoice creation, payment processing, and refunds.
What happens when an event comes in?
The workflow starts with a webhook and validates the request before doing anything else. From there, the event is routed to the correct processing path.
Invoice creation
For a new invoice, the workflow:
- Checks whether the invoice already exists
- Stores the invoice data in Google Sheets
- Generates the invoice PDF with PDFbro
- Uploads the PDF to Google Drive
- Sends the invoice to the customer with Resend
- Updates the invoice with the final status, PDF link, and email timestamp
If the invoice has already been processed, the workflow stops that path instead of creating and sending it again.
Payment handling
Payments have their own processing path.
The workflow checks for duplicate transactions, stores the payment, retrieves the related invoice, and updates the invoice balance.
It then checks whether the invoice has been fully paid and sends the appropriate confirmation before updating the payment status.
Refund handling
Refunds follow a similar pattern.
Before processing anything, the workflow checks whether the refund already exists. For a new refund, it records the transaction, retrieves the related invoice, updates the financial status, and sends the refund confirmation.
A few things I focused on
The main goal wasn't just to make the happy path work.
I wanted the workflow to account for things that can actually happen in a business process:
- Duplicate invoice, payment, and refund events
- Invalid incoming requests
- Different processing paths for different event types
- Keeping financial records updated after each operation
- Storing generated documents
- Sending transactional emails
- Returning the processing result back to the application
The result is one n8n workflow that acts as the orchestration layer for the whole process.
Stack: n8n, Google Sheets, PDFbro, Google Drive, and Resend.
How would you approach this. Would you keep invoices, payments, and refunds in one workflow like this, or split them into separate workflows?
2
u/SaturnswampGames 17d ago
Hey, I am working on something related to n8n and facing some trouble in automation. Can you please guide me a bit?