Overview
Sync your Lago billing data to QuickBooks Online automatically using this community-maintained integration. It uses n8n as middleware to transform Lago webhooks into QuickBooks API calls — so your accounting records stay in sync with your billing, without lifting a finger.How it works
The integration uses n8n (a workflow automation platform) as middleware between Lago and QuickBooks Online.What gets synced
| Lago Event | QuickBooks Action | Description |
|---|---|---|
customer.created | Create/Update Customer | Creates customer record with billing details |
customer.updated | Update Customer | Updates existing customer information |
invoice.created | Create Invoice | Creates invoice with line items and taxes |
invoice.one_off_created | Create Invoice | Creates one-off invoice |
credit_note.created | Create Credit Memo | Creates credit memo for refunds/adjustments |
invoice.payment_status_updated | Create Payment (if succeeded) | Records successful payments |
invoice.voided | Void Invoice | Voids invoice in QuickBooks |
Key features
Auto-create customers
Creates QuickBooks customers on-the-fly when processing invoices.
Exact tax override
Uses Lago’s tax calculations instead of QuickBooks tax rates.
Duplicate prevention
Checks for existing records before creating new ones.
Item mapping
Map Lago item codes to QuickBooks products/services.
Batch processing
Handle high-volume invoice creation with concurrency control.
Retry logic
Automatic retries with exponential backoff for transient failures.
Prerequisites
Required accounts
Required accounts
- Lago account with API and webhook endpoints access
- QuickBooks Online account (Essentials, Plus, or Advanced)
- n8n instance — n8n Cloud or self-hosted
QuickBooks developer setup
QuickBooks developer setup
- Create a QuickBooks Developer account
- Create a new app in the Developer Portal
- Note your Client ID and Client Secret
- Set the OAuth2 redirect URI to
https://your-n8n-instance.com/rest/oauth2-credential/callback
Technical requirements
Technical requirements
- n8n version 0.235.0 or higher
- HTTPS endpoint for webhook receiver (required for production)
- QuickBooks Online API access (included with QB Online subscriptions)
Installation
Deploy the n8n workflow
- Import from file
- Import from URL (n8n Cloud)
- Download
lago-quickbooks-main.jsonfrom the GitHub repository - In n8n, go to Workflows → Add workflow
- Click the ⋮ menu → Import from file
- Select the downloaded file and click Import
Configure QuickBooks OAuth2 credentials
- In n8n, click + → Credentials → Add credential
- Search for QuickBooks OAuth2 API
- Fill in the details:
| Field | Value |
|---|---|
| Credential name | QuickBooks OAuth2 |
| Client ID | From QuickBooks Developer Portal → Your App → Keys & credentials |
| Client Secret | From QuickBooks Developer Portal → Your App → Keys & credentials |
| Environment | sandbox for testing, production for live data |
| Scope | com.intuit.quickbooks.accounting |
- Click Connect my account, authorize in QuickBooks, then Save
Configure the workflow
The workflow has two configuration nodes.
See Item mapping and Tax mapping below for details.
HMAC Signature node
Open the Verify HMAC Signature node and edit theCONFIG object:| Field | Required | Description |
|---|---|---|
LAGO_WEBHOOK_SECRET | Yes | From Lago → Settings → Webhooks → Secret |
QB_ENVIRONMENT | Yes | sandbox for testing, production for live |
QB_REALM_ID | Yes | Your QuickBooks company ID (see below) |
QB_DEFAULT_ITEM_ID | Yes | Default QuickBooks Item ID — see Item mapping |
QB_DISCOUNT_ACCOUNT_ID | No | Account ID for discounts/credits |
BYPASS_SIGNATURE | No | Skip signature verification (dev only) |
How to find your QB_REALM_ID
How to find your QB_REALM_ID
Log into QuickBooks Online and look at the URL:
https://app.qbo.intuit.com/app/homepage?realmId=123456789The number after realmId= is your Realm ID. Alternatively, use the API Explorer and look for CompanyInfo.Id.How to find your QB_DEFAULT_ITEM_ID
How to find your QB_DEFAULT_ITEM_ID
Go to QuickBooks → Settings → Products and Services, click an item, and grab the ID from the URL:
https://qbo.intuit.com/app/item?id=1 — here, the Item ID is 1.Item Mappings Config node
Open the Item Mappings Config node and edit theMAPPINGS object:Get your webhook URL
- In n8n, open the workflow and click the Lago Webhook Receiver node
- Copy the Production URL (e.g.,
https://your-n8n.com/webhook/lago-webhook)
For production, you need an HTTPS webhook URL. n8n Cloud provides this automatically. For self-hosted n8n, ensure your instance is accessible via HTTPS.
Configure Lago webhooks
- In Lago, go to Settings → Webhooks → Add a webhook endpoint
- Paste the n8n webhook URL from the previous step
- Enable HMAC signature (strongly recommended)
- Copy the Signature secret and paste it into the
LAGO_WEBHOOK_SECRETfield in n8n - Set
BYPASS_SIGNATURE: falsefor production
Item mapping
Item mapping connects Lago billing items to QuickBooks products/services, so you can track revenue by product line. When Lago sends an invoice, each fee includes anitem.code (e.g., "premium_plan"). The workflow looks it up in ITEM_MAPPINGS and uses the matched QuickBooks Item ID — or falls back to ITEM_FALLBACK_ID if there’s no match.
Find your QuickBooks Item IDs
Go to QuickBooks → Settings → Products and Services, click an item, and note the ID from the URL.
List your Lago item codes
In Lago, check Billable metrics and Plans for the
code field on each item.Tax mapping
The integration uses QuickBooks’ tax override feature — Lago’s exact tax amounts show up in QuickBooks, regardless of QB’s own tax rates. No recalculation, no rounding surprises. Under the hood:- Line items are marked
TAXorNONbased on Lago data - The exact tax total from Lago is set via
TxnTaxDetail.TotalTax - The API uses
minorversion=70to enable the override
Find your Tax Code ID
Troubleshooting tax issues
Troubleshooting tax issues
Tax amount doesn’t match — Verify
QB_TAX_CODE_ID is set and points to a taxable code (not “NON”).QuickBooks recalculates tax — Ensure minorversion=70 is in the API URL. The workflow includes this by default — check the node settings if you’ve modified things.Understanding the flow
Workflow architecture
Event flows
Customer Created/Updated
Customer Created/Updated
Deduplicates by
DisplayName — updates if found, creates if not.Invoice Created
Invoice Created
Auto-creates missing customers and prevents duplicates by checking
DocNumber.Credit Note Created
Credit Note Created
Same flow as Invoice Created, but creates a Credit Memo in QB.
Payment Status Updated
Payment Status Updated
Only
succeeded creates a QB Payment. Other statuses are logged and skipped.Invoice Voided
Invoice Voided
Error handling
Retries
All QB API calls retry up to 5 times with exponential backoff.
Rate limiting
1-second wait between API calls to stay within QB limits.
Duplicate prevention
Lookups before creation prevent duplicate records.
Missing customers
Auto-created when processing invoices or credit notes.
Scaling
| Limit | Value |
|---|---|
| Requests per minute | 500 |
| Concurrent requests | 10 |
| Per-second limit | 10 |
| Scenario | Throughput | Time for 10k invoices |
|---|---|---|
| Default (10 concurrent) | ~100/min | ~100 minutes |
| Optimized (parallel) | ~300/min | ~33 minutes |
Testing
Always test in QuickBooks Sandbox (QB_ENVIRONMENT: 'sandbox') before going to production.
Checklist
- Customer sync: Create/update customer in Lago → verify in QB
- Invoice creation: Create invoice in Lago → verify items and tax in QB
- Credit note: Create credit note → verify credit memo in QB
- Payment: Mark invoice as paid → verify payment in QB
- Duplicate prevention: Send same invoice twice → only one in QB
- Tax calculation: Tax amount in QB matches Lago exactly
- Item mapping: Correct QB items are used
Troubleshooting
Webhook not received in n8n
Webhook not received in n8n
- Check the webhook URL in Lago settings
- Verify the workflow is Active in n8n
- Check n8n firewall/network settings
HMAC validation fails
HMAC validation fails
- Verify
LAGO_WEBHOOK_SECRETmatches Lago exactly - Check for extra spaces when copying the secret
QuickBooks authentication fails
QuickBooks authentication fails
- Re-authorize the OAuth2 credential in n8n
- Verify Client ID and Secret are correct
Tax amounts don't match
Tax amounts don't match
- Check
QB_TAX_CODE_IDis set and points to a taxable code (not “NON”) - Verify
minorversion=70is in the API URL (included by default)
Production checklist
Before going live:-
QB_ENVIRONMENTset toproduction -
BYPASS_SIGNATUREset tofalse -
QB_REALM_IDmatches your production company - Item mappings configured and tested
-
QB_TAX_CODE_IDconfigured (if using tax) - QuickBooks OAuth2 credential authorized for production
- Lago webhook endpoint configured with HMAC enabled
- n8n workflow set to Active
- Error notifications configured (email/Slack)