Use AI to Check Invoices Against Purchase Orders and Receipts

An invoice can add up perfectly and still leave you with work to do. The supplier bills in pieces, the receiving team counts boxes, and a second invoice arrives before you've finished checking the first.

I'd start by asking an AI assistant to put those documents side by side: find the matching order lines, preserve the units, and point to the entries that need another look. Once the numbers are checked, it can draft a question for purchasing or the receiving team. That gives the person reviewing the bill a much smaller, more specific job.

The useful output is something like “INV-B charges $1.65 per bracket; the order says $1.50. Was that change agreed?” You can answer that. A general warning about possible discrepancies leaves you searching through the documents again.

Let's build that sheet with a fictional order, two receiving records and two invoices. The practice kit includes the source text, an AI prompt, a manually prepared answer key and a small Python checker. No real supplier or customer data is used, and the exercise doesn't measure AI extraction accuracy or time saved.

Start with the work you want off your desk

Most of the work happens before you reach the calculator. You have to find the right order, work out which receipt goes with it, and check whether “box” means the same thing on both documents. Try AI on that reading and organizing work, then review its proposed matches. The arithmetic can run from the corrected fields.

For example, Microsoft's invoice extraction model returns structured fields and line items from documents. That gives you something to work with; you still need to establish which order and receiving records those fields belong to.

A review sheet needs the original unit and a source reference beside each quantity and price. Keep unresolved matches on the sheet, too. A model may treat two similar descriptions as the same item even though one is a different size. A blank match with a reason gives you something to investigate.

If your purchasing system already does this reliably, I'd keep that calculation there and try AI on the awkward inputs: PDFs, emailed explanations and documents that need clarification. Exporting everything into a second matching system creates another set of records to maintain.

One order, two invoices, and a missing receipt

Our fictional buyer, Cedar Workshop, orders three items under PO DEMO-100. All prices are in US dollars. Tax, delivery charges and other fees are explicitly zero in this exercise. There are no returns, credits, discounts or changes to the order.

The brackets are ordered as 10 boxes of 20 pieces at $30 per box. That's 200 pieces at $1.50 each. The receiving records show six boxes arriving, then another two: 160 accepted pieces in total.

INV-A bills for 100 brackets at $1.50 each. INV-B bills for another 80, this time at $1.65 each. Together, they bill for 180 brackets. Checking either invoice against the original 200-piece order in isolation would miss the gap against recorded receipts.

The pads arrive in two batches of 40 and are also invoiced in two batches of 40. The sealant is on the order and INV-B, but its receiving evidence hasn't been supplied. We don't know whether it arrived.

Here's the review sheet after converting the units and combining the two unique invoices:

Item Ordered Billed so far Accepted receipts Follow-up
BR-10 brackets 200 pieces 180 pieces 160 pieces 20 pieces above recorded receipts; INV-B also has a $12 price difference
PAD-4 pads 80 pieces 80 pieces 80 pieces No difference in the fields checked
SEAL-1 sealant 24 tubes 24 tubes Evidence unavailable Ask for the receiving record

The $12 is the price difference on INV-B's 80 brackets: 80 × ($1.65 − $1.50). It isn't a recommended deduction. The price and quantity issues overlap, and someone still needs to establish whether the additional goods arrived or the price was changed by agreement.

There's an assumption behind that table: we have all the invoices and all the bracket and pad receipt records through October 6, 2026. The exercise says so explicitly. With a real folder of uploads, I'd ask the record owner to confirm that coverage. Otherwise, the 20-piece gap might be explained by a receipt nobody attached.

Comparing invoices with purchase orders and receipts is commonly called three-way matching. Microsoft's worked matching examples distinguish price comparisons against an order from quantity comparisons against receipts. Any tolerances belong to the buyer's own rules; our exercise flags every price difference so the example is easy to inspect.

Give the assistant a reading task it can show its work on

You can try the exercise in an AI tool your organization permits for the documents involved. Attach the five source text files from the kit, including the repeated copy of INV-A. Start with this request:

Extract the invoice and receipt lines into a review worksheet.
Keep the original quantity, unit, price and filename/line reference.
Suggest a PO-line match using the supplier, PO reference and SKU.
Show the evidence for each unit conversion. Mark matches as candidates.
Use null for missing or unclear information; include a review reason.
Report repeated invoice IDs and conflicting versions separately.
Do not infer zero receipts from a missing receiving document.
Return the extraction and proposed matches for review before calculation.

The full prompt in the kit also asks for cumulative comparisons and clarification drafts. Pause at the extraction first. Check the supplier, invoice identity, SKU and packing quantity against the originals before asking for an explanation of the differences. If the PO match is wrong, the later comparison will be wrong as well.

One bracket row should lead to a worksheet entry like this:

Source: invoice-b.txt, INV-B, L1
Extracted: BR-10, 80 pieces, $1.65/piece, line amount $132.00
Candidate match: purchase-order.txt, DEMO-100, L1, BR-10
PO conversion evidence: 20 pieces per box; $30.00 per box
Reviewed comparison price: $1.50 per piece
Price difference to check: $12.00

That's a worked target for this fictional row, not a recorded model benchmark. In the download, the normalized JSON is an author-prepared answer key. Compare an assistant's actual extraction with the documents before accepting it. The Python script reads that reviewed JSON; it doesn't read the source documents or validate the assistant's interpretation for you.

If purchasing questions that $12, the references give them a short route back: INV-B, L1 for the billed price; DEMO-100, L1 for the box price and pack size. For a real PDF, keep the filename, page and row, or a link to the selected area. Nobody should have to take the assistant's word for a number.

A repeated file shouldn't become another bill

The kit includes an identical copy of INV-A under a different filename. Adding every file total would produce $798. Counting each unique invoice once produces $558: $240 for INV-A and $318 for INV-B.

The checker reports the repeated import and excludes its extra copy from the arithmetic. It uses the supplier and exact invoice ID, then compares the reviewed contents. If the same ID arrives with different contents, calculation stops so a person can resolve the versions. It doesn't guess which one is newer or valid.

That still doesn't tell you whether an invoice was already paid. In this exercise both unique invoices are unpaid by definition. In a working process, you'd need the payment history as well before making any payment decision.

With Python 3.10 or later installed, unzip the kit, open its folder in a terminal and run python check_examples.py, then python reconcile.py. The second command writes results.json and review.csv. Both are review outputs; the script has no payment or accounting-system connection. You can also open the included sample CSV without running Python.

The checker keeps a price difference visible even if another line cancels it out in the total. It also stops when a line hasn't been matched, a unit conversion is unknown, or the arithmetic doesn't agree. Those are reasons to return to the documents. Its other input checks, including supplier, PO, currency and complete invoice history, are listed in the kit's README.

This small checker handles the goods-only example. Before using it on a batch with credits, returns, extra charges or a rounding policy, extend the handling and review the result. Leaving those documents out to make the numbers match would defeat the exercise. You'll also need to link specific receipts to invoice lines if your accounting process requires that allocation; the cumulative totals here don't do it.

Turn each difference into a question someone can answer

The bracket finding could produce this draft for the receiving team: “The supplied records show 160 accepted BR-10 pieces against 180 invoiced through October 6. Is another receiving record missing, or does the supplier need to revise the quantity? References: RCPT-A/L1, RCPT-B/L1, INV-A/L1 and INV-B/L1.”

For the price difference, ask purchasing whether the change from $1.50 to $1.65 per piece was agreed. For the sealant, ask for receiving evidence. These are different questions with different owners. Combining them into “invoice incorrect” would lose that distinction.

An assistant can draft those questions from the reviewed sheet. Someone should check the wording and choose who gets them. No message needs to leave the draft stage automatically.

If you've already used AI to compare supplier quotes, you can carry the agreed terms into this later check. Start with one small, complete set of documents. Keep a note of the fields you had to correct and the follow-up questions you actually used. Then decide whether the assistant took useful work off your desk.