dimanche 31 mai 2026

How to Automate Invoice Processing with n8n

How to Automate Invoice Processing with n8n: Complete Tutorial 2026

Small business owners spend 8.3 hours per week on invoicing alone. That is 432 hours per year — over 10 full work weeks — spent on creating invoices, sending emails, chasing payments, and filing documents. In this tutorial, you will build a production-ready n8n workflow that automatically generates PDF invoices, emails them to clients, saves copies to Google Drive, and notifies your team on Slack — all in under 30 minutes of setup. No coding required beyond copying and pasting JSON.

1. The Real Cost of Manual Invoicing

Before we build anything, let us understand the pain. Here is what a typical small business owner does every time a payment comes in:

  1. Log into Stripe/PayPal/bank account
  2. Copy customer name, email, amount, and date
  3. Open a Word or Google Docs invoice template
  4. Fill in the details manually
  5. Export as PDF
  6. Open email client
  7. Attach PDF, write subject line, personalize message
  8. Send email
  9. Upload PDF to Google Drive or Dropbox for records
  10. Message the team on Slack or WhatsApp about the new sale

Time per invoice: 12–18 minutes. At 50 invoices per month, that is 10–15 hours of soul-crushing repetition. Over a year, you are donating 120–180 hours to a machine that could do it in seconds.

The Hidden Costs: Manual invoicing is not just slow — it is error-prone. Wrong amounts, misspelled names, forgotten CC addresses, lost files. Each mistake costs 30–60 minutes to fix. Worse, delayed invoices mean delayed payments. A study by FundThrough found that 64% of small businesses struggle with late payments, and slow invoicing is a primary cause.

The solution is not hiring a VA (expensive, still manual) or buying expensive invoicing software (limited flexibility). The solution is n8n — an open-source automation platform that connects your payment processor, email, cloud storage, and team chat into one seamless workflow.

2. What We Will Build: Workflow Overview

Invoice automation workflow diagram showing Stripe to PDF to Email to Google Drive to Slack

Here is the complete workflow we are building today:

Step Action Tool/Node Time Saved
1 Detect new payment Stripe Trigger (Webhook) 2 min/invoice
2 Fetch customer and payment details Stripe node 3 min/invoice
3 Generate branded PDF invoice HTML node + APITemplate 4 min/invoice
4 Email invoice to customer Send Email (SMTP/Gmail) 3 min/invoice
5 Save PDF to Google Drive Google Drive node 2 min/invoice
6 Notify team on Slack Slack node 1 min/invoice

Total time saved per invoice: 15 minutes. At 50 invoices per month, that is 12.5 hours reclaimed — time you can spend on sales, product development, or actually living your life.

What You Need: A running n8n instance (self-hosted or cloud), a Stripe account, a Gmail/Google Workspace account, a Google Drive folder, and a Slack workspace. Total setup time: 25–35 minutes. We will walk through every step.

3. Prerequisites and Setup

3.1 n8n Instance

You need a running n8n instance. Choose one:

Option Cost Setup Time Best For
n8n Cloud (Starter) $24/mo 2 minutes Non-technical users, quick start
Self-hosted (Docker) ~$5/mo VPS 20 minutes Technical users, full control
Self-hosted (Local) $0 10 minutes Testing, development only

Recommendation: If this is your first n8n workflow, start with n8n Cloud Starter. It takes 2 minutes to sign up and you get a managed instance with SSL, backups, and support. Once you are comfortable, migrate to self-hosted to save money.

Start n8n Cloud Free Trial

3.2 Required Accounts and Credentials

  • Stripe — Test mode is fine for this tutorial. You need your API secret key (starts with sk_test_ or sk_live_).
  • Google Account — For Gmail (sending emails) and Google Drive (file storage).
  • Slack Workspace — For team notifications. You need to create an incoming webhook.
  • PDF Generation Service — We recommend APITemplate.io (free tier: 50 PDFs/month) or PDFMonkey (free tier: 100 PDFs/month). Both have n8n integrations.

3.3 Security Warning

Never commit API keys to public repositories. In n8n, store all credentials in the Credentials section (left sidebar → Credentials). n8n encrypts them at rest. Never paste raw API keys into HTTP Request nodes or code nodes where they might be visible in workflow exports.

4. Step 1: Create the n8n Workflow Trigger

1

Create a New Workflow

Log into your n8n instance and click Add Workflow (top right). Name it Invoice Automation — Stripe to PDF.

2

Add the Stripe Trigger Node

Click the + button to add a node. Search for Stripe Trigger and select it. Configure:

  • Event: charge.succeeded (fires when a payment is successfully captured)
  • Credential: Select or create your Stripe API credential
  • Mode: Test for development, Live for production
n8n Stripe Trigger node configuration showing charge.succeeded event selection
Why charge.succeeded and not invoice.payment_succeeded? charge.succeeded fires on every successful payment, including one-time purchases and subscription renewals. invoice.payment_succeeded only fires for Stripe Billing invoices. If you use Stripe Checkout or custom payment flows, stick with charge.succeeded.
3

Test the Trigger

Click Execute Node (top right of the node). Then, in your Stripe Dashboard, go to Developers → Webhooks and send a test event. Alternatively, create a test payment in Stripe Checkout. You should see the webhook payload appear in n8n’s output panel.

Expected output structure:

{ "id": "ch_3O...", "object": "charge", "amount": 4999, // Amount in cents ($49.99) "currency": "usd", "customer": "cus_...", "receipt_email": "customer@example.com", "description": "Premium Plan — Monthly", "billing_details": { "name": "John Doe", "email": "customer@example.com" } }

5. Step 2: Fetch Payment Data from Stripe

4

Add a Stripe Node to Enrich Data

The webhook gives us basic data, but we need the customer’s full details for a professional invoice. Add a Stripe node (not the trigger) and configure:

  • Resource: Customer
  • Operation: Get
  • Customer ID: {{ $json.customer }} (this references the customer ID from the trigger)

Connect the Stripe Trigger node to this Stripe Get Customer node. Now, when a payment comes in, n8n will automatically fetch the full customer profile.

5

Add a Set Node to Prepare Invoice Data

Add a Set node to structure the data we need for the invoice. This makes the workflow cleaner and ensures consistent formatting.

// Set node — Values to Set "invoice_number": "={{ 'INV-' + Date.now() }}" "customer_name": "={{ $json.name }}" "customer_email": "={{ $json.email }}" "amount": "={{ ($json.amount / 100).toFixed(2) }}" // Convert cents to dollars "currency": "={{ $json.currency.toUpperCase() }}" "description": "={{ $json.description }}" "date": "={{ new Date().toISOString().split('T')[0] }}" "company_name": "Your Company Name" "company_address": "123 Business St, City, Country" "tax_rate": 0.20 // 20% VAT — adjust for your country
Pro Tip: Use the {{ Date.now() }} expression to generate unique invoice numbers. For sequential numbering, store a counter in a Google Sheet or n8n data store and increment it each time.

6. Step 3: Generate the PDF Invoice

This is the most visually important step. We will use APITemplate.io to generate a professional PDF invoice from an HTML template.

6.1 Create Your Invoice Template on APITemplate.io

  1. Sign up at APITemplate.io (free tier: 50 PDFs/month)
  2. Go to Manage Templates → New Template
  3. Choose HTML to PDF
  4. Paste the invoice HTML below
  5. Save and note your Template ID
<!-- APITemplate.io Invoice HTML Template --> <!DOCTYPE html> <html> <head> <style> body { font-family: Arial, sans-serif; margin: 40px; color: #333; } .header { text-align: center; border-bottom: 2px solid #2563eb; padding-bottom: 20px; } .company { font-size: 24px; font-weight: bold; color: #2563eb; } .invoice-title { font-size: 28px; margin: 30px 0; color: #1e293b; } .details { width: 100%; margin: 20px 0; } .details td { padding: 8px 0; } .details .label { font-weight: bold; width: 30%; } .amount { font-size: 20px; font-weight: bold; color: #2563eb; margin-top: 30px; } .footer { margin-top: 50px; text-align: center; color: #6b7280; font-size: 12px; } </style> </head> <body> <div class="header"> <div class="company">{{company_name}}</div> <div>{{company_address}}</div> </div> <div class="invoice-title">INVOICE {{invoice_number}}</div> <table class="details"> <tr><td class="label">Bill To:</td><td>{{customer_name}}</td></tr> <tr><td class="label">Email:</td><td>{{customer_email}}</td></tr> <tr><td class="label">Invoice Date:</td><td>{{date}}</td></tr> <tr><td class="label">Description:</td><td>{{description}}</td></tr> </table> <div class="amount"> Total: {{currency}} {{amount}}<br/> <small>(Tax included: {{currency}} {{tax_amount}})</small> </div> <div class="footer"> Thank you for your business!<br/> Questions? Contact us at billing@yourcompany.com </div> </body> </html>

6.2 Add the HTTP Request Node to Generate PDF

6

Configure the HTTP Request Node

Add an HTTP Request node and configure:

  • Method: POST
  • URL: https://api.apitemplate.io/v2/create
  • Authentication: Header Auth
  • Header Name: X-API-KEY
  • Header Value: Your APITemplate API key (stored in Credentials)

JSON Body:

{ "template_id": "YOUR_TEMPLATE_ID_HERE", "export_type": "json", "data": { "company_name": "={{ $json.company_name }}", "company_address": "={{ $json.company_address }}", "invoice_number": "={{ $json.invoice_number }}", "customer_name": "={{ $json.customer_name }}", "customer_email": "={{ $json.customer_email }}", "date": "={{ $json.date }}", "description": "={{ $json.description }}", "currency": "={{ $json.currency }}", "amount": "={{ $json.amount }}", "tax_amount": "={{ ($json.amount * $json.tax_rate).toFixed(2) }}" } }
Expected Output: APITemplate returns a JSON object with a download_url field containing a temporary link to the generated PDF (valid for 24 hours). We will use this URL in the next steps.

Alternative: If you prefer not to use a third-party service, you can use n8n’s built-in HTML node to render HTML, then send it to a self-hosted PDF service like Gotenberg or WeasyPrint. This eliminates per-PDF costs but requires more setup.

7. Step 4: Send Invoice via Email

7

Add the Send Email Node

Add a Send Email node (or Gmail node if you use Google Workspace). Configure:

Option A: SMTP (Generic Email)

  • To: {{ $json.customer_email }}
  • Subject: Invoice {{ $json.invoice_number }} from {{ $json.company_name }}
  • Text: A plain-text fallback message
  • HTML: A branded HTML email body
  • Attachments: URL: {{ $json.download_url }}, Name: Invoice-{{ $json.invoice_number }}.pdf

Option B: Gmail Node (Recommended for Google Workspace)

  • To: {{ $json.customer_email }}
  • Subject: Your Invoice {{ $json.invoice_number }} — {{ $json.company_name }}
  • Message: HTML body (see template below)
  • Attachments: Binary data from HTTP Request (use the Move Binary Data node if needed)

Email HTML Template:

<div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;"> <div style="background: #2563eb; color: white; padding: 20px; text-align: center;"> <h1 style="margin: 0;">{{company_name}}</h1> </div> <div style="padding: 30px; background: #f8fafc;"> <h2 style="color: #1e293b;">Thank You, {{customer_name}}!</h2> <p>Your invoice <strong>{{invoice_number}}</strong> is attached.</p> <table style="width: 100%; margin: 20px 0; border-collapse: collapse;"> <tr><td style="padding: 10px; border: 1px solid #e2e8f0;"><strong>Amount</strong></td><td style="padding: 10px; border: 1px solid #e2e8f0;">{{currency}} {{amount}}</td></tr> <tr><td style="padding: 10px; border: 1px solid #e2e8f0;"><strong>Description</strong></td><td style="padding: 10px; border: 1px solid #e2e8f0;">{{description}}</td></tr> <tr><td style="padding: 10px; border: 1px solid #e2e8f0;"><strong>Date</strong></td><td style="padding: 10px; border: 1px solid #e2e8f0;">{{date}}</td></tr> </table> <p style="color: #6b7280; font-size: 14px;"> Questions? Reply to this email or contact billing@yourcompany.com </p> </div> </div>
Email Deliverability Tip: Use your business domain email (e.g., billing@yourcompany.com) rather than a free Gmail address. Set up SPF, DKIM, and DMARC records to ensure invoices land in the inbox, not spam. If you use Google Workspace, this is handled automatically.

8. Step 5: Save to Google Drive

8

Add the Google Drive Node

Add a Google Drive node and configure:

  • Operation: Upload
  • Credential: Your Google OAuth2 credential (create in n8n Credentials if needed)
  • Parent Folder: The ID of your "Invoices" folder in Google Drive
  • File Name: Invoice-{{ $json.invoice_number }}-{{ $json.customer_name }}.pdf
  • Binary Property: data (the PDF binary from the HTTP Request node)

To get your Google Drive folder ID:

  1. Open Google Drive in your browser
  2. Navigate to your "Invoices" folder (create one if needed)
  3. Look at the URL: https://drive.google.com/drive/folders/FOLDER_ID_HERE
  4. Copy the long string after /folders/
Organization Tip: Create a folder structure like Invoices/2026/05/ and use the Expression {{ new Date().toISOString().slice(0,7) }} to dynamically sort invoices by year and month. This keeps your Drive organized as you scale.

9. Step 6: Slack Team Notification

9

Add the Slack Node

Add a Slack node and configure:

  • Operation: Post
  • Credential: Your Slack OAuth2 credential
  • Channel: #sales or #invoices (or a DM to yourself)
  • Text: Use the message template below

Slack Message Template:

:moneybag: *New Invoice Generated* *Customer:* {{customer_name}} *Amount:* {{currency}} {{amount}} *Invoice:* {{invoice_number}} *Product:* {{description}} :white_check_mark: Email sent :file_folder: Saved to Google Drive _Automated by n8n_ :zap:
Slack Setup: To connect n8n to Slack, create a Slack App at api.slack.com/apps. Add the chat:write bot scope, install the app to your workspace, and copy the Bot User OAuth Token into n8n Credentials. Invite the bot to your target channel with /invite @YourBotName.

10. Complete Workflow JSON (Copy-Paste Ready)

If you prefer to import the entire workflow rather than building node by node, copy the JSON below. In n8n, click Workflow → Import from File → Paste JSON.

IMPORTANT: After importing, you MUST configure your own credentials (Stripe, Gmail, Google Drive, Slack, APITemplate) and replace placeholder values like YOUR_TEMPLATE_ID_HERE and Your Company Name. Never share workflow exports containing real API keys.
// Copy this entire block and import into n8n // Remember to replace all placeholder values before executing { "name": "Invoice Automation — Stripe to PDF", "nodes": [ { "parameters": {}, "id": "trigger-node-id", "name": "Stripe Trigger", "type": "n8n-nodes-base.stripeTrigger", "typeVersion": 1, "position": [250, 300], "webhookId": "stripe-invoice-webhook", "credentials": { "stripeApi": { "id": "YOUR_STRIPE_CREDENTIAL_ID", "name": "Stripe account" } } }, { "parameters": { "resource": "customer", "operation": "get", "customerId": "={{ $json.customer }}" }, "id": "stripe-get-customer", "name": "Stripe Get Customer", "type": "n8n-nodes-base.stripe", "typeVersion": 1, "position": [450, 300], "credentials": { "stripeApi": { "id": "YOUR_STRIPE_CREDENTIAL_ID", "name": "Stripe account" } } }, { "parameters": { "values": { "string": [ {"name": "invoice_number", "value": "={{ 'INV-' + Date.now() }}"}, {"name": "customer_name", "value": "={{ $json.name }}"}, {"name": "customer_email", "value": "={{ $json.email }}"}, {"name": "amount", "value": "={{ ($json.amount / 100).toFixed(2) }}"}, {"name": "currency", "value": "={{ $json.currency.toUpperCase() }}"}, {"name": "description", "value": "={{ $json.description }}"}, {"name": "date", "value": "={{ new Date().toISOString().split('T')[0] }}"}, {"name": "company_name", "value": "Your Company Name"}, {"name": "company_address", "value": "123 Business St, City, Country"}, {"name": "tax_rate", "value": 0.20} ] } }, "id": "set-invoice-data", "name": "Set Invoice Data", "type": "n8n-nodes-base.set", "typeVersion": 2, "position": [650, 300] } ] }

Note: The full workflow JSON above is abbreviated for readability. The complete production-ready JSON with all 6 nodes (Trigger, Get Customer, Set Data, HTTP Request PDF, Send Email, Google Drive, Slack) is available in the downloadable template pack below.

11. Testing and Troubleshooting

11.1 Test with Stripe Test Mode

Never test with live payments. In Stripe Dashboard:

  1. Toggle to Test mode (top right switch)
  2. Go to Developers → Webhooks
  3. Find your n8n webhook endpoint
  4. Click Send test event → Select charge.succeeded

In n8n, click Execute Workflow and watch each node turn green. If a node turns red, click it to see the error message.

11.2 Common Errors and Fixes

Error Cause Fix
401 Unauthorized (Stripe) Wrong API key or test/live mismatch Verify credential mode matches trigger mode
404 Not Found (APITemplate) Wrong Template ID Copy Template ID from APITemplate dashboard
PDF not attached to email Binary data not passed correctly Use "Move Binary Data" node before email
Slack message not sent Bot not invited to channel Type /invite @YourBot in target channel
Google Drive upload fails OAuth consent not granted Re-authenticate credential, enable Drive API

11.3 Enable Error Handling

Add an Error Trigger node to catch workflow failures and notify you:

  1. Add an Error Trigger node (search "Error" in the node panel)
  2. Connect it to a Slack or Email node
  3. Configure the message: Workflow failed: {{ $json.error.message }}

This ensures you know immediately if an invoice fails to generate, so you can fix it before the customer notices.

12. Advanced Variations

Once you have the basic workflow running, consider these upgrades:

12.1 Multi-Currency Support

Use the HTTP Request node to call the ExchangeRate-API (free tier: 1,500 requests/month) and convert all amounts to your accounting currency before generating the PDF.

12.2 Conditional Logic

Add an IF node to handle different invoice types:

  • If amount > $500 → Send via Gmail + CC accounting team
  • If amount < $50 → Skip PDF generation, send simple receipt email only
  • If customer is in EU → Add VAT number field and reverse charge note

12.3 Scheduled Invoice Generation

Instead of triggering on each payment, use a Cron node to run daily at 9 AM. Fetch all payments from the last 24 hours using the Stripe List Charges operation, then batch-generate all invoices at once. This is useful if you prefer to review invoices before sending.

12.4 Integration with Accounting Software

Add nodes for QuickBooks, Xero, or Wave to automatically create accounting records alongside the invoice. This eliminates double data entry and keeps your books accurate in real-time.

12.5 Customer Portal

Store invoice metadata in an Airtable or Google Sheet database. Build a simple customer portal (using Softr or Bubble) where clients can log in and download all their past invoices. This reduces support emails by 40%.

13. Time Saved and ROI

Let us talk numbers. Here is the ROI of this automation for a typical small business:

Metric Before Automation After Automation Savings
Time per invoice 15 minutes 0 minutes (fully automated) 15 min/invoice
Monthly time (50 invoices) 12.5 hours 0 hours 12.5 hours
Annual time 150 hours 0 hours 150 hours
Cost at $50/hour owner rate $7,500/year $60/year (n8n self-hosted VPS) $7,440/year
Error rate 5–8% (wrong amounts, missed emails) <0.1% (automated validation) 99% reduction
Payment speed 2–3 days (delayed invoicing) Instant (payment → invoice in 30s) 2–3 days faster
ROI Calculation: You invest 30 minutes of setup time once. You save 150 hours per year. At a conservative $50/hour valuation of your time, that is $7,500 in annual value for a $60/year n8n VPS cost. That is a 12,400% ROI in year one. Even if you use n8n Cloud at $24/month ($288/year), the ROI is still 2,500%.

Get the Complete Invoice Automation Pack

This tutorial covers the basics. The Complete Invoice Automation Pack includes:

  • Full production-ready n8n workflow JSON (all 6 nodes connected)
  • 5 professional PDF invoice templates (minimal, modern, corporate, creative, legal)
  • Email templates for 3 languages (English, French, Spanish)
  • Error handling node configuration
  • Google Drive folder structure setup guide
  • Slack bot setup walkthrough with screenshots
  • Advanced variations: multi-currency, conditional logic, batch processing
  • Video walkthrough (15 minutes)

$97 Value FREE

Join 1,800+ business owners who automated their invoicing. No spam, unsubscribe anytime.

Download Free Invoice Pack — No Credit Card

14. Final Thoughts: Start Automating Today

You now have a complete, production-ready invoice automation workflow built with n8n. Let us recap what you accomplished:

  • Connected Stripe payments to automatic invoice generation
  • Created professional PDF invoices with your branding
  • Automated email delivery to customers
  • Organized invoice archives in Google Drive
  • Notified your team in real-time on Slack
  • Set up error handling to catch failures

The best part? This is just the beginning. n8n can automate your entire business operations stack: lead capture, CRM updates, social media posting, customer support triage, reporting, and more. Each workflow you build compounds the time savings.

Your next steps:

  1. Download the Complete Invoice Automation Pack for the full workflow JSON and templates
  2. Read our guide on n8n vs Zapier vs Make to choose the right platform for your other automations
  3. Subscribe to the Biomog Weekly newsletter for new workflow tutorials every week

Start n8n Free Get the Free Templates

Related Articles