Skip to content
Inan Jaggi

All projects

2026 · Customer deployment · accounts payable

AP Invoice Matching

  • Forward-deployed
  • Accounts payable
  • Evaluation

An open-source invoice-matching engine deployed for a fictional manufacturer's AP team. It reads supplier invoice PDFs, matches them to purchase orders and receiving records, and approves, holds or rejects each one with reasons. I built what a real deployment needs: an adapter for the customer's ERP export, their AP policy as configuration, routing to the right reviewer, a daily batch, and an evaluation on their invoices.

The evaluation in four numbers
  1. 52/53decisions correct
  2. 0false approvals (defaults: 2)
  3. 11review queues routed
  4. 98.5%invoice lines read exactly
My role
Solo build
Team
Fictional customer, synthetic data
Result
52 / 53 synthetic invoices decided correctly, with zero false approvals
Status
Public · 29 tests passing
Tools and methods
Python, invoice-agent (open source), PDF extraction, ERP CSV integration, pytest

The problem

The customer gets about 2,000 supplier invoices a month and has three AP clerks. Castings prices drift above the PO, suppliers sometimes send the same invoice twice, and every exception has to reach the right person: the buyer for price, receiving when billing runs ahead of receipts, the AP lead for duplicates.

What I built

  • An adapter for the ERP's own export, which the engine's loader can't read: cancelled lines dropped, returns turned into negative receipts, 2-way matching where no receipt is required, plus the usual byte-order marks, thousands separators and US dates.
  • The AP policy as configuration: a 1% price tolerance for castings, 5% for MRO supplies, 0% for contracted freight, and a routing table from reason code to queue and owner.
  • A daily batch that writes an approved-invoices file for ERP import, an exceptions queue with reasons and owners, and an audit trail, with a saved ledger that catches duplicates across days.
  • A seeded set of 53 invoices from 7 fictional suppliers, made with the engine's own generator.

Results

  • 52 of 53 decisions correct (98.1%), no false approvals, and all 19 labeled exceptions caught.
  • With default settings, the same engine got 49 right and approved 2 invoices the customer wants reviewed: a castings line 1.5% over the PO and a freight rate 1.9% over contract.
  • With perfect extraction the policy scores 53 of 53, so the one miss comes from reading the PDF, not from matching.

What I don't claim

  • The data and labels are mine. It hasn't seen real supplier PDFs, scans or new layouts.
  • The one miss: the engine can't detect Mexican pesos, so peso invoices go to review. That fails safe, and the fix belongs in the engine itself.
  • There is no approval-amount limit yet: a fully matched invoice is approved at any value.