Skip to main content

Automatiser sa facturation avec l'IA

Workflows n8n détaillés pour automatiser devis, factures, paiements et relances

Technical Guide
By Victor
13 min read

A typical SME spends an average of 14 hours per month on outgoing invoicing: drafting quotes, converting them to invoices, sending them, tracking payments, and chasing late payers. It's a critical process that's repetitive and time-consuming.

What if you could automate 80% of this work? In this guide, we'll show you how to build an automated billing system with n8n and AI, from quote to payment reminders.

1. The 6 billing steps you can automate

Outgoing billing follows a predictable cycle. Each step is an ideal candidate for automation:

  QUOTE           ORDER            INVOICE         SEND            TRACK           FOLLOW-UP
┌─────────┐   ┌──────────┐   ┌──────────┐   ┌─────────┐   ┌──────────┐   ┌──────────┐
│ Quote   │──▶│ Quote    │──▶│ Invoice  │──▶│ Auto    │──▶│ Payment  │──▶│ Auto     │
│ Creation│   │ Approval │   │ PDF      │   │ Send    │   │ Matching │   │ Reminders│
└─────────┘   └──────────┘   └──────────┘   └─────────┘   └──────────┘   └──────────┘
  Manual        Semi-auto       100% auto      100% auto     100% auto      AI + auto
    

1. Quote Creation

Auto-generate from your CRM when a deal moves to the "quote" stage. Customer data, product lines, and terms are pre-filled automatically.

2. Quote to Invoice Conversion

As soon as the client accepts (electronic signature, confirmation email), the quote transforms into an invoice with sequential, compliant numbering.

3. PDF Generation

Invoice PDF is automatically generated with your branding, mandatory legal notices, and correct VAT calculation based on the client's country.

4. Client Delivery

Personalized email with the invoice attached, sent from your professional address. The client also receives a direct payment link.

5. Payment Tracking

Automatic reconciliation between issued invoices and bank transactions. Status changes to "paid" as soon as the transfer is detected.

6. Smart Reminders

AI-personalized reminder emails based on client history, with progressive escalation: friendly reminder, formal notice, formal demand.

Did you know?

According to a Sage study (2024), French SMEs lose on average 22 days of cash flow per year because invoices are sent late or reminders are not sent. Automating billing reduces DSO (Days Sales Outstanding) by an average of 35%.

2. Why n8n is the ideal tool for billing

There are dozens of automation tools (Zapier, Make, Power Automate...). Here's why n8n stands out specifically for billing:

No-code + Code when needed

The visual interface lets you build workflows without coding. But when you need complex logic (intra-community VAT calculation, custom numbering), the JavaScript Code node is there.

Self-hosted = GDPR by default

Your billing data is sensitive. With n8n self-hosted, nothing leaves your infrastructure. No risk of data transfers to US servers.

Built-in AI Nodes

n8n natively integrates LLM nodes (OpenAI, Claude, Mistral) that let you generate personalized reminder emails, analyze payment habits, or classify clients.

500+ Integrations

Connect directly to your CRM, billing tool, bank, and accounting software. No need to develop custom connectors.

Quick comparison: n8n vs Zapier for billing

Criteria n8n Zapier
Self-hostingYesNo
Native AI nodesYes (LLM, AI Agent)Limited
Code nodeFull JavaScriptBasic
Cost (50 workflows)~20 EUR/month~150 EUR/month
Unlimited workflowsYes (self-hosted)No

Don't have time to set all this up?

We deploy automated billing systems in 2 to 4 weeks, tailored to your existing tools.

Let's discuss →

3. 3 concrete workflows to implement

Workflow 1: Auto-generate invoices from your CRM

The scenario: a salesperson closes a deal in HubSpot or Pipedrive. In seconds, an invoice PDF is generated and sent to the client, with no human intervention.

┌──────────────┐    ┌───────────────┐    ┌──────────────────┐    ┌──────────────┐
│  HubSpot /   │───▶│  Extract      │───▶│  PDF Generation  │───▶│   Send       │
│  Pipedrive   │    │  deal data    │    │  (HTML template) │    │   email      │
│  (Trigger)   │    │  + client     │    │                  │    │   + PDF      │
└──────────────┘    └───────────────┘    └──────────────────┘    └──────────────┘
  "Deal won"         Name, SIRET,         Compliant invoice       Personalized
                     address, VAT         legal notices           + payment link
                                                  │
                                                  ▼
                                      ┌──────────────────────┐
                                      │  Save to             │
                                      │  Google Drive +      │
                                      │  Pennylane/Sheets    │
                                      └──────────────────────┘
    

The n8n nodes involved:

  1. 1. HubSpot Trigger — Triggers the workflow when a deal reaches "Closed Won" status
  2. 2. HubSpot Node (Get Contact) — Retrieves client info: name, SIRET, address, email, VAT regime
  3. 3. Code Node (Numbering) — Generates sequential invoice number (e.g., INV-2026-0042) and calculates gross/VAT/net amounts
  4. 4. HTML Node — Generates invoice HTML from a template with injected data
  5. 5. HTTP Request (HTML→PDF) — Converts HTML to PDF via an API like Gotenberg or PDFShift
  6. 6. Gmail / SMTP Node — Sends email with invoice attachment and Stripe payment link
  7. 7. Google Drive Node — Archives PDF in a folder organized by year/month
  8. 8. Google Sheets / Pennylane Node — Records invoice in accounting tracking

The Code node for numbering:

// Code node - Invoice number generation
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');

// Retrieve last number from Google Sheets
const lastNumber = $input.first().json.last_invoice_number || 0;
const newNumber = lastNumber + 1;

const invoiceNumber = `INV-${year}-${String(newNumber).padStart(4, '0')}`;

// Calculate amounts
const items = $input.first().json.deal_items;
const grossAmount = items.reduce((sum, l) => sum + (l.price * l.quantity), 0);
const vatRate = $input.first().json.client_vat_rate || 0.20;
const vat = grossAmount * vatRate;
const netAmount = grossAmount + vat;

return {
  invoice_number: invoiceNumber,
  amount_gross: grossAmount.toFixed(2),
  vat: vat.toFixed(2),
  amount_net: netAmount.toFixed(2),
  date_issued: now.toISOString().split('T')[0],
  date_due: new Date(now.setDate(now.getDate() + 30))
    .toISOString().split('T')[0]
};
    

Workflow 2: Smart automatic reminders

This is where AI makes the difference. Instead of sending a generic "Your invoice is overdue" email, AI drafts a message tailored to the client's context and severity of delay.

┌──────────────┐    ┌───────────────┐    ┌──────────────────┐    ┌──────────────┐
│  Schedule    │───▶│  Query        │───▶│  Classify        │───▶│  Generate    │
│  Trigger     │    │  unpaid       │    │  delay           │    │  AI email    │
│  (daily      │    │  invoices     │    │  (D+7/D+15/D+30) │    │  (LLM Node)  │
│   9am)       │    │  (Sheets/DB)  │    │                  │    │              │
└──────────────┘    └───────────────┘    └──────────────────┘    └──────────────┘
                                                                        │
                                             ┌────────────────────────┤
                                             ▼                        ▼
                                     ┌──────────────┐        ┌──────────────┐
                                     │  Send email  │        │  Internal    │
                                     │  reminder    │        │  alert       │
                                     │  personalized│        │  (Slack)     │
                                     └──────────────┘        └──────────────┘
    

The escalation logic:

Delay Tone Action
D+7FriendlyEmail reminder, courteous tone
D+15FormalFormal reminder + internal manager copy
D+30FirmFormal demand + management alert
D+45LegalPre-litigation email + accounting notification

The AI prompt for reminder generation:

// LLM Node (Claude or GPT-4) - Prompt
"You are the accounting assistant for [COMPANY_NAME].
Draft a reminder email for an unpaid invoice.

Context:
- Client: {{ $json.client_name }}
- Invoice: {{ $json.invoice_number }}
- Amount: {{ $json.amount_net }} EUR
- Due date: {{ $json.date_due }}
- Days overdue: {{ $json.days_overdue }}
- Client history: {{ $json.payment_history }}
- Reminder level: {{ $json.reminder_level }}

Rules:
- Level 1 (D+7): Friendly tone, assume oversight
- Level 2 (D+15): Professional tone, mention terms
- Level 3 (D+30): Firm tone, mention late payment penalties
- Level 4 (D+45): Legal tone, mention applicable law

If the client has a good payment history, soften the tone.
Respond with subject and email body only."
    

Workflow 3: Automatic payment reconciliation

The final link in the chain: automatically detect when an invoice is paid, update its status, and alert if a payment is partial or incorrect.

┌──────────────┐    ┌───────────────┐    ┌──────────────────┐
│  Bank API    │───▶│  Filter       │───▶│  Reconcile       │
│  or Stripe   │    │  incoming     │    │  AI (match       │
│  (Webhook)   │    │  transactions │    │  invoice/payment)│
└──────────────┘    └───────────────┘    └──────────────────┘
                                                   │
                            ┌───────────────────────┼───────────────────────┐
                            ▼                       ▼                       ▼
                    ┌──────────────┐        ┌──────────────┐        ┌──────────────┐
                    │  Exact match │        │  Partial     │        │  No match    │
                    │  → Status    │        │  match       │        │  → Alert     │
                    │  "Paid"      │        │  → Alert     │        │  accounting  │
                    └──────────────┘        └──────────────┘        └──────────────┘
    

How AI reconciliation works:

The LLM node analyzes the bank transfer reference and tries to match it to an open invoice. It handles complex cases: truncated references, grouped payments (one transfer for 3 invoices), or slightly different amounts (discount, rounding).

// Code node - Reconciliation logic
const transaction = $input.first().json;
const openInvoices = $('Get Open Invoices').all();

// Try exact match by amount
const exactMatch = openInvoices.find(
  f => Math.abs(f.json.amount_net - transaction.amount) < 0.01
);

if (exactMatch) {
  return {
    match_type: 'exact',
    invoice_id: exactMatch.json.invoice_number,
    action: 'mark_paid'
  };
}

// Try match by reference
const refMatch = openInvoices.find(
  f => transaction.reference.includes(f.json.invoice_number)
);

if (refMatch) {
  const diff = transaction.amount - refMatch.json.amount_net;
  return {
    match_type: diff === 0 ? 'exact' : 'partial',
    invoice_id: refMatch.json.invoice_number,
    difference: diff.toFixed(2),
    action: Math.abs(diff) < 1 ? 'mark_paid' : 'alert_partial'
  };
}

// No match - send to LLM for analysis
return {
  match_type: 'none',
  action: 'ai_analysis',
  transaction_data: transaction
};
    

4. Key integrations

n8n natively connects to all tools in your billing stack. Here are the most relevant integrations:

CRM & Sales

  • HubSpot
  • Pipedrive
  • Salesforce
  • Folk CRM
  • Notion (as CRM)

Billing & Accounting

  • Pennylane
  • Sellsy
  • QuickBooks
  • Xero
  • FreshBooks

Payment & Banking

  • Stripe
  • GoCardless
  • Qonto (API)
  • Bridge API (bank aggregator)
  • Mollie

Communication

  • Gmail / Outlook (SMTP)
  • Slack
  • Microsoft Teams
  • WhatsApp Business

Storage & Documents

  • Google Drive
  • SharePoint / OneDrive
  • Dropbox
  • AWS S3

AI & Generation

  • OpenAI (GPT-4)
  • Anthropic (Claude)
  • Mistral AI
  • Gotenberg (HTML→PDF)

5. Before/after: concrete results

Here are the results observed at an SME providing B2B services (35 employees, ~120 invoices/month) after implementing these 3 workflows:

-82%

Time spent on billing

From 14 hours to 2.5 hours per month

-12 days

DSO reduction

From 47 days to 35 days on average

0 errors

Billing errors

Versus 3-4 errors/month before

Case study: Engineering consulting SME

BEFORE (manual process)

  • - Invoices manually drafted in Word
  • - Sent via email one by one
  • - Payment tracking on Excel spreadsheet
  • - Reminders sent "when we remember"
  • - 3 to 5 days late on sending
  • - 8% error rate (amount, VAT, address)

AFTER (n8n + AI)

  • + Invoices generated in 30 seconds from CRM
  • + Auto-sent with Stripe payment link
  • + Daily automated bank reconciliation
  • + AI reminders at D+7, D+15, D+30 hands-free
  • + Sent same day deal closes
  • + 0% errors thanks to validated templates

Concrete financial impact: reducing DSO by 12 days on annual revenue of 2M EUR represents approximately 65,000 EUR in permanent cash flow recovery. Add to this the hours saved and reduction in bad debts.

6. Do it yourself or get expert help?

The good news: n8n is accessible. The bad news: a reliable automated billing system requires rigor.

Do it yourself

Ideal if you have technical staff in-house and time to invest.

  • Budget: ~20 EUR/month (n8n cloud) + AI APIs
  • Setup time: 2 to 6 weeks
  • Risks: Configuration errors, legal non-compliance, maintenance
  • Best for: Less than 30 invoices/month

Get expert help

Ideal if billing is critical and you want a reliable system quickly.

  • Budget: Initial investment + maintenance
  • Setup time: 2 to 4 weeks
  • Benefits: Guaranteed compliance, full testing, ongoing support
  • Best for: More than 30 invoices/month or high stakes

Critical points not to overlook

  • Legal compliance: Mandatory notices, sequential numbering, 10-year retention
  • Electronic invoicing 2026: Mandatory reception of electronic invoices from September 2026. Your system must be compatible with standard formats.
  • International VAT: Automatic VAT rate management by client country (reverse charge, reduced rate, exemption)
  • Legally valid archiving: PDFs must be signed and timestamped to have legal value

7. Frequently asked questions

Can n8n generate legally compliant invoices?

Yes, if you configure the templates correctly. Mandatory information (SIRET, VAT number, payment terms, late payment penalties) must be integrated in the HTML template. n8n generates the dynamic content, but you (or your integrator) must ensure template compliance.

How long does it take to set up the first workflow?

The invoice generation workflow can be operational in 3 to 5 days for a technical person. Reminder and reconciliation workflows add 1 to 2 weeks. Expert support typically deploys everything in 2 to 4 weeks including testing and training.

Can AI make mistakes in reminders?

The AI generates email content, but factual data (amount, invoice number, date) are injected from your database, not invented by AI. The risk of error is limited to tone and wording. Manual validation of the first generated emails is recommended before going 100% automatic.

Is it compatible with the 2026 electronic invoice reform?

n8n can interface with authorized e-invoicing platforms or standard compliance services via their APIs. The workflow can be adapted to emit invoices in standard formats like Factur-X (PDF/A-3 with embedded XML).

What is the total cost of an n8n billing solution?

Self-hosted: server cost (~10-30 EUR/month) + AI APIs (~5-20 EUR/month depending on volume) + PDF APIs (~5 EUR/month). n8n Cloud: from 20 EUR/month. Initial setup investment is separate and depends on complexity of your existing stack.

Sources

  • Sage Research, "The Domino Effect: The Impact of Late Payments", 2024
  • n8n Documentation — docs.n8n.io
  • Electronic invoicing regulations — Global compliance framework for e-invoicing standards
  • OECD Guidelines on VAT management across borders
  • Late payment penalties regulations — Compliance framework
  • Best practices guide for electronic document archiving, 2025

Automate your billing with an expert

We design custom automated billing systems for SMEs. From auditing your current process to full deployment, we support you at every step.

Contact us →

Prêt à automatiser vos processus ?

Diagnostic gratuit de 30 minutes. Nous analysons vos workflows actuels et identifions les automatisations les plus impactantes.