Automated workflow · n8n + Claude

Invoice Vendor Discrepancy Review

Every vendor invoice gets checked against its purchase order the moment it arrives — not batched into a Friday pile for AP to sort through. A webhook receives the invoice and PO fields, Claude flags concrete discrepancies and decides whether to auto-approve, hold, or dispute, and the result is archived and returned immediately.

2
auto-approved
1
held for review
2
disputed

What separates approve from dispute

Claude compares the invoice to its PO on price, quantity, line items, and PO validity, then applies strict cutoffs on the variance between invoice and PO amount.

Approve · ≤3% variance, no other issues
Hold · >3% and ≤15% variance, or a line item worth a second look
Dispute · >15% variance, missing/invalid PO, or unmatched line items
PO validity
Does a real, matching purchase order exist for this vendor?
Price & quantity
Do the unit prices and quantities match what was ordered?
Line items
Does every invoiced item appear on the PO — no surprise charges?
Variance
How far off is the total dollar amount, as a share of the PO?

How an invoice moves through it

One straight path from intake to review, then a three-way fork on the result. All three land in the same archive and response.

01 · trigger
Invoice Webhook
POST /webhook/invoice-discrepancy-review receives the invoice and PO fields.
02 · normalize
Normalize Invoice Input
Cleans the payload and computes the dollar and percent variance between invoice and PO.
AI Review Invoice
Claude flags discrepancies, decides the tier, then drafts the tier-appropriate action itself — an AP note, an internal flag, or a vendor email.
Route by Discrepancy Tier
Routes on tier: approve / hold / dispute.
if approve
Tag Auto-Approve
Marks the record for the AP ledger log.
if hold
Tag Hold for Review
Marks the record for the AP reviewer's Slack/email queue.
if dispute
Tag Dispute
Marks the record for the vendor-email queue.
Save Reviewed Invoice
All three branches converge here — archived to the invoices_reviewed Data Table.
Respond With Review
Sends the variance, discrepancies, and drafted action straight back to whatever submitted the invoice.

Five test invoices, reviewed live

The invoices below are made-up test data, not real transactions. The discrepancy tiers, flagged issues, and drafted actions are genuine, unscripted output — each one is what Claude actually produced from running that invoice against its PO through the live workflow.

INV-58231 · Northfield Office Supplies
PO-90142 · Recurring quarterly office equipment order
Approve
Invoice vs. PO
Invoice
$4,820.00
PO
$4,820.00
Variance
$0.00 · 0.00%
Reasoning
Clean match against PO-90142 — both line items (desk converters and setup/delivery fee) align exactly on quantity, unit price, and extended total. No discrepancies detected.
Automated action · internal AP ledger note
ap-ledger-logauto-drafted
AP Ledger Note — INV-58231 | Northfield Office Supplies | PO-90142 Invoice reviewed and approved for payment. All line items match PO-90142 exactly. Total invoice amount of $4,820.00 equals PO amount with $0 variance (0.00%). PO reference valid; no discrepancies identified. Cleared for payment on or before due date of 2026-09-20.
INV-58288 · Meridian Janitorial Services
PO-90410 · Routine monthly recurring service
Approve
Invoice vs. PO
Invoice
$2,150.75
PO
$2,150.00
Variance
$0.75 · 0.03%
Reasoning
A $0.75 supply-restock variance is 0.03% of the total PO value — well within the ≤3% approval threshold, and consistent with the documented usage-based fluctuation noted for this recurring contract.
Automated action · internal AP ledger note
ap-ledger-logauto-drafted
AP Ledger Note — INV-58288 | Meridian Janitorial Services | PO-90410 Invoice approved for payment. Amount: $2,150.75 | Due: 2026-09-25. All line items verified against PO-90410. Supply Restock variance of $0.75 is 0.03% of total PO value — within the ≤3% auto-approval threshold. No PO reference issues, no unrecognized items. Clear to pay.
INV-58270 · Alpine Print & Signage
PO-90333 · Vinyl banner order, partial-delivery follow-up
Hold
Invoice vs. PO
Invoice
$3,564.00
PO
$3,300.00
Variance
$264.00 · 8.00%
Flagged discrepancies (4)
Quantity
330 units invoiced vs. 300 authorized — vendor says it completes a held-over partial delivery, unverified.
Unit price
$10.80 invoiced vs. $11.00 on PO — an unauthorized change either direction needs sign-off.
Reasoning
The 8% variance falls in the hold range. Both the quantity overage and the price change are unverified against any change order — ops needs to confirm before payment releases.
Automated action · internal Slack/email flag
#ap-review-queueauto-drafted
Hey AP team / Ops — flagging INV-58270 from Alpine Print & Signage for review before we pay. Invoice total: $3,564.00 vs. PO total: $3,300.00 (+$264 / +8.00%) 1. Quantity overage (+30 units): vendor says it completes a partial delivery held over from last month. Can ops confirm this was pre-approved? 2. Unit price change ($11.00 → $10.80): wasn't agreed in the PO — need written confirmation or an amended PO. Holding payment until we hear back.
INV-58244 · Redstone Industrial Parts
PO-90210 · Steel bracket order plus a rush surcharge
Dispute
Invoice vs. PO
Invoice
$12,850.00
PO
$11,200.00
Variance
$1,650.00 · 14.73%
Flagged discrepancies (2)
Unauthorized line item
A $1,650 rush shipping surcharge appears on the invoice with no corresponding PO line — only discussed informally over email.
Reasoning
The bracket line items match the PO exactly, but the entire variance is driven by a surcharge with zero PO backing. Informal email discussion doesn't constitute an authorized change order.
Automated action · drafted vendor email
INV-58259 · Quantum Cloud Hosting LLC
No PO on file · first invoice from this vendor
Dispute
Invoice vs. PO
Invoice
$9,400.00
PO
$0.00
Variance
$9,400.00 · 100%
Flagged discrepancies (4)
Missing PO
No PO number provided, and procurement has no record of engaging this vendor at all.
Unrecognized vendor
First-ever invoice from this company — a classic pattern for fraudulent or misdirected invoices.
Reasoning
Fails every standard AP check simultaneously: no PO reference, no PO on file, no procurement record of the vendor, and a 100% variance against zero authorized spend. Must not be paid until authorization is established.
Automated action · drafted vendor email

Every tier gets a drafted action, not just dispute

The same AI call that reviews the invoice also drafts what happens next, matched to the tier: approve gets a brief AP ledger note, hold gets an internal flag to the AP reviewer, and dispute gets a professional email addressed to the vendor. Nothing is left as a bare pass/fail — even the cleanest invoice above got a real drafted note.

What is invoices_reviewed? It's a Data Table — a lightweight database built directly into this n8n workspace, not a separate external system. It lives inside this n8n project, viewable in n8n's own Data Tables screen and reachable by any other workflow in the same project. It isn't exposed to the public internet on its own — the only way anything outside n8n sees this data is through what a workflow deliberately sends back out, like the drafted actions above.
invoice_id vendor_name variance_percent discrepancy_tier discrepancy_count reasoning
INV-58231 Northfield Office Supplies 0.00% approve 0 Exact match against PO — clear to pay.
INV-58288 Meridian Janitorial Services 0.03% approve 0 Negligible restock variance, within documented tolerance.
INV-58270 Alpine Print & Signage 8.00% hold 4 Unverified quantity overage and price change — needs ops sign-off.
INV-58244 Redstone Industrial Parts 14.73% dispute 2 Rush surcharge has zero PO backing, only discussed informally.
INV-58259 Quantum Cloud Hosting LLC 100% dispute 4 No PO, unrecognized vendor, first-ever invoice — hold pending verification.

Going live: what changes outside this demo

Nothing here runs on a manual trigger in production. A real invoice has to enter this pipeline the moment it's received, and the result has to land somewhere a person actually sees it — usually the AP system of record.

where invoices already are
AP inbox or vendor portal
An invoice landing in the AP inbox, or submitted through a vendor portal, fires a webhook the instant it arrives, carrying the extracted invoice and matched PO fields.
unchanged from this demo
This review pipeline
Same normalize → review → draft sequence shown above.
write-back
AP system updated
Variance, tier, and discrepancies get written onto the invoice record — so anyone opening it in the AP system sees them, not just this workflow's log.
human in the loop
Real Slack/email post + a reviewed draft
Hold flags post to a real AP-review channel immediately. Vendor dispute emails land as a draft for a quick read before sending — not an auto-send.

Why not just use the AP system's built-in 3-way match?

Tools like NetSuite, Bill.com, and Coupa ship their own invoice-vs-PO matching, and at a company that already has one configured well, this workflow isn't a replacement for it.

Where a custom pipeline like this earns its place: native 3-way match is typically a strict pass/fail on price and quantity, it's often a paid add-on gated behind a higher pricing tier, and it doesn't draft the actual follow-up — a reviewer still has to write the vendor email or the internal flag by hand. This build is the shape you reach for when native matching isn't available at your tier, doesn't exist for your AP system, or needs judgment calls (like the informally-discussed surcharge above) that a strict rules engine can't make.