Automate Invoicing and Accounting with n8n: From Sale to Payment Collection
There is a particular kind of dread that comes with invoicing. You close a deal, celebrate for five minutes, and then realize you need to create an invoice, format it correctly, send it to the client, track whether they paid, follow up if they did not, update your accounting spreadsheet, and reconcile everything at the end of the month. It is tedious, error-prone, and honestly beneath anyone whose time is better spent on revenue-generating work.
I used to lose an entire afternoon at the end of each month chasing invoices. As a startup consultant working with multiple clients simultaneously, I had invoices going out on different schedules, in different currencies, with different payment terms. Some clients paid on time. Most did not. Tracking it all in a spreadsheet was a nightmare that got worse every month.
So I automated the entire process with n8n. Now, when a deal closes, an invoice is automatically generated, sent to the client, tracked in my accounting system, and if the client does not pay on time, a polite reminder email goes out automatically — escalating in tone as the overdue period grows. I spend zero time on invoicing, and my collection rate has gone from about 85% to over 97%.
In this guide, I will walk you through every step of building this system.
Why Automate Invoicing with n8n?
You might wonder why I did not just use an invoicing tool like FreshBooks, QuickBooks, or Xero. Those are great tools, and I actually use some of them as part of my pipeline. But the key insight is that invoicing is not a standalone process — it is connected to your sales pipeline, your CRM, your email, your accounting, and your client communication.
n8n sits at the center of all these systems. It does not replace your accounting software — it connects everything together and automates the handoffs between them. The result is a seamless process where no step is forgotten, no invoice is sent late, and no payment slips through the cracks.
Here is what n8n brings to the table for invoicing automation:
Event-driven triggers. Instead of remembering to create an invoice when a deal closes, n8n detects the event automatically and kicks off the process immediately.
Multi-system orchestration. A single invoice workflow can touch your CRM (to get deal details), your invoicing tool (to create the invoice), your email (to send it), your spreadsheet (to log it), and your Slack (to notify you). n8n orchestrates all of this in one workflow.
Conditional logic. Different clients have different payment terms, currencies, and communication preferences. n8n handles all the branching logic to customize the process per client.
Scheduled follow-ups. The reminder system runs on a schedule and automatically identifies overdue invoices and sends appropriate follow-up messages. No manual tracking required.
The Complete Invoice Automation Pipeline
Here is the full pipeline, broken into five stages:
1. Trigger — Detect when a new invoice should be created
2. Invoice Generation — Create the invoice with all the correct details
3. Delivery — Send the invoice to the client
4. Payment Tracking — Monitor payment status
5. Overdue Reminders — Automatically follow up on unpaid invoices
Let me walk through each stage in detail.
Stage 1: Detecting When to Create an Invoice
The pipeline starts with a trigger that detects when a new invoice should be generated. I use multiple trigger sources depending on the business model:
CRM deal closure. For project-based work, the primary trigger is when a deal moves to “Closed Won” in the CRM. I use a HubSpot Trigger node (or a Webhook that listens for HubSpot deal stage changes) that fires whenever a deal’s stage changes to “Closed Won.” The trigger payload includes the deal amount, client contact information, deal name, and any custom properties like payment terms or currency.
Recurring schedule. For retainer clients who get invoiced monthly, I use a Schedule Trigger that fires on the 1st of every month. The workflow then queries the CRM for all active retainer deals and generates an invoice for each one.
Stripe events. For product sales or subscription-based businesses, a Webhook node listens for Stripe’s `invoice.created` event. When Stripe generates an invoice (for a new subscription, a renewal, or a one-time charge), the workflow picks it up and handles the downstream processing.
Manual trigger. For ad-hoc invoices that do not map to a CRM deal (consulting hours, expense reimbursements, etc.), I have a manual trigger with a simple form where I enter the client name, amount, description, and payment terms. The rest of the process runs identically.
All four triggers feed into a common pipeline through a Merge node that normalizes the input data into a consistent format: client_name, client_email, invoice_amount, currency, description, payment_terms_days, and due_date.
Stage 2: Invoice Generation
Once the trigger fires and the data is normalized, the workflow generates the actual invoice.
Invoice number generation. Every invoice needs a unique number. I use a Function node that queries a Google Sheet to find the last invoice number, increments it, and generates the new number in a format like “INV-2026-0042.” The new number is immediately written back to the sheet to prevent duplicates if two invoices are generated simultaneously.
Client data enrichment. The trigger data gives me the basic client information, but the invoice needs complete billing details: company name, billing address, tax ID, and payment instructions. I use an Airtable node (or Google Sheets, depending on the client setup) to look up the full client record from a client database using the client email as the key.
Invoice creation via API. I use the HTTP Request node to call the invoicing platform’s API. For clients who use FreshBooks, I call the FreshBooks API to create a new invoice with all the line items, tax rates, and payment terms. For clients on QuickBooks, I use the QuickBooks API. The structure is similar — create a draft invoice with the client details, line items, and due date.
If the business does not use an invoicing platform, I generate a PDF invoice directly within n8n. I use a Function node that populates an HTML invoice template with the invoice data, and then call a PDF generation service (like PDFShift or a self-hosted Puppeteer instance) via the HTTP Request node to convert the HTML to a professionally formatted PDF. The template includes the company logo, invoice number, date, due date, line items with descriptions and amounts, subtotal, tax, and total, plus bank transfer details or a payment link.
Tax calculation. For clients in different countries, I need to apply different tax rates. A Switch node checks the client’s country and applies the appropriate VAT, GST, or sales tax rate. For clients in Chile (where I am based), I apply the 19% IVA. For European clients, I apply the relevant EU VAT rate. For US clients, sales tax varies by state. A lookup table in Google Sheets stores the rate for each jurisdiction.
The Function node calculates the subtotal, tax amount, and total, and adds these to the invoice data.
Getting Started with n8n
If you are still creating invoices manually, you are wasting time that could be spent on your actual business. Try n8n here to set up your invoicing automation — you can connect your CRM, invoicing tool, and email in minutes and start automating the entire process.
Stage 3: Invoice Delivery
Once the invoice is created, the workflow delivers it to the client.
Email delivery. The primary delivery method is email. I use the Gmail node (or SendGrid for clients with higher volume) to send a professional email with the invoice attached as a PDF.
The email subject follows a consistent format: “Invoice INV-2026-0042 from [Company Name].” The body includes a brief message thanking the client for their business, the invoice amount and due date, payment instructions (with a direct link to pay online if the invoicing platform supports it), and the invoice PDF as an attachment.
I personalize the email based on the client relationship. For new clients, the tone is more formal. For long-standing clients, it is warmer and more conversational. A Switch node checks the client’s tenure (calculated from their first invoice date) and selects the appropriate email template.
Client portal. For invoicing platforms like FreshBooks or Xero that have a client portal, the workflow also triggers the platform’s built-in delivery mechanism, which sends the client a link to view and pay the invoice online. The n8n email then serves as a personal touch on top of the automated platform notification.
Copy to accounting. Simultaneously, the workflow sends a copy of the invoice to the company’s accounting email address (for record-keeping) and logs the invoice in a Google Sheet that serves as the accounts receivable ledger. The ledger includes columns for invoice number, date, client, amount, currency, due date, status (sent, paid, overdue), and payment date.
Slack notification. A Slack message notifies the finance channel that a new invoice has been sent, including the invoice number, client name, amount, and due date. This gives the team visibility without requiring them to check the accounting system.
Stage 4: Payment Tracking
After the invoice is sent, the workflow monitors for payment.
Stripe payment matching. For clients who pay via St