Business operations

How to match purchase orders, delivery notes and invoices with AI

To match purchase orders, delivery notes and invoices with AI, first verify the source fields and line identifiers. Compare invoice prices with the purchase order and invoice quantities with the selected accepted receipts, accounting for previous billing where relevant. Keep missing evidence and duplicate candidates visible, then give the exceptions to the responsible reviewer. A matching result does not authorize payment.

In this article

Start with the three questions the documents can answer

A purchase order records what was ordered under the supplied terms. A delivery note describes a shipment, while an accepted goods-receipt record establishes what the receiving process recorded as received. An invoice asks for payment. Those documents relate to the same transaction, but they do not establish the same fact. A supplier's delivery note alone may not prove that your team accepted the shipment.

The practical AI task is to organize and compare that evidence. Ask whether the billed item belongs to the intended order line, whether its price follows the supplied terms, and whether the quantity is supported by the receipts selected for that invoice. Keep the answers separate. A correct price cannot make up for missing receipt evidence.

Microsoft's invoice-matching documentation distinguishes price matching from three-way matching, which also compares invoiced quantities with selected product receipts. Its tolerances are configurable. This guide uses that distinction to frame a small independent exercise, rather than reproduce the behavior of a particular finance system.

The download contains invented purchase orders, receipt records and invoices. The receipt CSV represents accepted quantities for the exercise. The expected results are authored calculations, not observed AI output or a recommendation to change your organization's payment controls.

Sources: Microsoft: accounts payable invoice matching overview

Write a matching rule before uploading the files

For this rehearsal, fix the review date at 30 October 2026. Select all four receipt records in the supplied file. There are no earlier billed quantities, returns, tax adjustments, discounts or freight charges in the exercise. The prices are USD per each, and the exercise uses zero price tolerance so a difference is easy to inspect.

These are teaching assumptions. A real matching policy may allow a specified variance, use net prices after adjustments, or require a particular receipt allocation. Get those rules from the process owner. An assistant should not choose a tolerance because a percentage seems conventional or because it makes the sample pass.

Also define the output's authority. The result is a review register with calculations, evidence references and next questions. It does not approve posting, verify banking details, establish tax treatment or decide whether an exception is commercially acceptable. Those decisions need the organization's existing authorization process.

Write the exclusions beside the instructions. If previous invoices or receipt allocations are absent in a real batch, say that cumulative quantity matching is unavailable. A clear limit is more useful than a confident result built on an imagined transaction history.

Keep a row for each source line and a reference for each document

The pack has four purchase-order lines, four receipt lines and six invoice source rows. Those counts measure records, not interchangeable goods. Adding folders, bolts and tags into a single quantity total would produce a number without a useful physical meaning.

Preserve VendorID, POID and POLine as text. Line 01 should survive sorting and export without losing its leading zero. Keep SKU, unit of measure and currency alongside the identifiers. A first line on one order is unrelated to a first line on another, and two suppliers can use the same invoice number.

Each invoice row also has a stable RowID and SourceFile. IR01 points to invoice-100.csv; IR06 points to invoice-100-copy.csv. They are separate source observations of the same apparent invoice identity, V01/I100. Keeping both references allows a reviewer to resolve the repetition without pretending that a file disappeared.

Retain the source CSVs unchanged and put generated values in a separate output. If you later correct a source transcription, record what changed and why. A spreadsheet full of overwritten values makes it difficult to distinguish a document fact from an editor's interpretation.

Related guide: Extract invoice fields without replacing the stated amounts

Validate the keys before comparing the numbers

First inspect whether each purchase-order key identifies exactly one line. The exercise key is VendorID plus POID plus POLine. Then confirm that the linked SKU, unit and currency agree with the invoice. A matching key with conflicting item information needs review rather than an automatic calculation.

Do not join on item descriptions alone. A description such as office supplies can cover several order lines, and a model may treat similar descriptions as equivalent. Use text similarity only to propose an unresolved candidate when an exact reference is absent. Keep that candidate separate from confirmed links.

Check that quantities and prices are present and numeric after import. A blank unit price is missing evidence, while an explicitly stated zero price is a value. Do not silently replace one with the other. If the original documents are PDFs, check extraction first using source pages and the invoice extraction workflow.

The practice files have clean key fields so you can focus on the matching logic. An operational batch may need a controlled vendor mapping or a corrected purchase-order reference. Ask the owner to confirm that mapping before relying on it across every row.

Prompt to try
Inspect these fictional purchase-order, receipt and invoice CSVs before matching. Report source row counts, missing required fields, duplicate purchase-order keys, repeated invoice identities, and conflicts in SKU, unit of measure or currency. Use exact VendorID + POID + POLine references. Preserve every source row and identifier. Do not repair references, infer missing documents or calculate a payment approval.

Aggregate selected receipts without multiplying the invoice

Purchase order PO0101 line 01 covers ten bolts at USD 5 each. Receipt R01 records six and receipt R02 records four. Together, the selected receipts support ten units. The invoice's ten units align with that selected receipt quantity before the duplicate-source issue is considered.

A direct join between one invoice row and two receipt rows can create two invoice rows. If the full invoice amount appears on both, a later sum doubles it. Aggregate the selected receipt quantities at the intended order-line level first, or preserve receipt allocations in a separate table with explicit quantities.

PO0101 line 02 demonstrates a partial delivery. Eight folders were ordered, five are represented by the selected accepted receipt, and invoice I101 bills eight. The quantity difference is three folders. Comparing the invoice only with the original order would miss that difference because eight equals the ordered quantity.

In a real process, the remaining three may be in transit, recorded under another receipt, disputed or omitted from the extract. The supplied evidence cannot choose among those explanations. Record the gap and the receiving owner's next question without changing the invoice quantity to five.

Account for previous billing before reusing a receipt

The practice pack states that there are no earlier invoices or allocations. That makes the selected receipt calculation transparent. Outside the exercise, a receipt of ten units might already support an earlier invoice for six. It cannot automatically support another invoice for ten merely because the same receipt is still visible.

Obtain prior billed quantities and the system's receipt-allocation rules when the review needs a cumulative answer. Separate quantities available for this invoice from total quantities received across the purchase order's life. Returns, credits and corrected receipts may also change the relevant balance.

Do not create an allocation sequence by sorting filenames. The order in which documents were uploaded says nothing about the order in which a business accepted goods or posted invoices. Preserve unresolved overlaps until an authorized source establishes which invoice uses which receipt quantity.

For this rehearsal, treat IR01 and IR06 as a duplicate candidate before considering them as two claims on the same receipt. Counting both as independent invoices would manufacture an apparent twenty-unit bill against ten receipts. Resolving document identity comes before interpreting that aggregate as a genuine overbilling problem.

Calculate price and quantity differences in different columns

For a linked, comparable line, the exercise quantity difference is invoice quantity minus selected received quantity. A positive result indicates a quantity beyond the selected receipts. Preserve the signed difference when useful, because a negative result may mean the invoice covers only part of a receipt rather than an error.

The exercise's price variance is invoice quantity multiplied by invoice unit price minus purchase-order unit price. For I102, twenty tags at USD 2.20 are compared with the order's USD 2.00. The unit difference is USD 0.20, and the line price variance is USD 4.00. The received quantity of twenty aligns.

Do not combine a quantity gap and a price difference into one unexplained risk amount. Three missing folders and a four-dollar price variance describe different questions. Nor does the price calculation establish that a final invoice total is correct: this exercise excludes tax, freight and discounts.

The workbook demonstrates these calculations on the fixed practice rows and retains a separate human-review field. Its source ranges are bounded to the exercise. Replacing it with a larger import requires extending and checking those ranges, not simply pasting records below the last formula.

Three comparisons in the fictional practice pack
InvoiceSelected receipt evidenceResult
I1006 + 4 bolts = 10Quantity and price align; repeated source still needs review
I1015 folders against 8 billed3 units beyond selected receipts
I10220 tags against 20 billedUSD 4.00 line price variance

Keep missing documents distinct from zero quantities

Invoice I103 refers to PO0103 line 01, which orders four wraps at USD 15 each. The invoice has the same quantity and price, but the receipt file contains no matching record. The correct finding is missing receipt evidence. The data does not prove that no wraps were delivered.

Invoice I104 refers to PO9999, which is absent from the purchase-order file. Its two boxes at USD 10 cannot be checked against an approved line in this pack. Keep the invoice's stated fields and identify the missing reference. Do not match it to another order because that order has a similar amount.

A spreadsheet lookup or conditional sum can return a zero when no receipt rows match. That numerical result needs a coverage check. A valid zero quantity explicitly recorded by a source and an absent source row have different meanings and should lead to different next questions.

An assistant may try to make the report more complete by inferring a likely order or assuming a shipment arrived. Reject those additions. The useful register makes the evidence boundary obvious: what was compared, what was unavailable, and who needs to supply the next document.

Investigate repeated invoices without deleting the trail

IR01 and IR06 share VendorID V01, InvoiceID I100, the order line, currency and amounts. Their filenames differ. That makes them a duplicate candidate group with two source observations, rather than proof that two payments happened or proof that one document may be discarded.

Keep a group reference and both RowIDs in the review register. An appropriate question is whether one file is a copy, a corrected version, or a distinct transaction whose identifier was entered incorrectly. The exercise intentionally provides no payment ledger, correction notice or supplier explanation.

For a provisional unique-invoice count, the pack contains five apparent invoice identities in six rows. Label that count as identity-based and keep the duplicate group unresolved. Avoid reporting six invoices as a confirmed liability or five invoices as an approved payment population.

A duplicate check can also produce false positives. A supplier might reuse an invoice number across entities, or a credit might refer to the original number. Define the business identity using the fields available in the actual system. In this exercise, the vendor and invoice combination is sufficient only because the supplied rules define the scope.

Ask for evidence, calculations and a review question together

Give the assistant the rules file as well as the three source CSVs. Ask it to describe its intended grain before producing the report. That first explanation often reveals whether it is about to sum full invoices after a many-to-many join or treat a missing receipt as a confirmed zero.

Require a separate result for every invoice source row. The duplicate group should not disappear during cleanup. Request the source RowID, linked purchase-order key, selected receipt IDs, extracted values, calculated differences, unresolved checks and next action. A reviewer should be able to find the relevant evidence without reverse-engineering the assistant's prose.

Save the initial output and compare it with the expected key before asking for corrections. If you supply the answer key at the beginning, you are testing whether the assistant can repeat it rather than whether it performed the comparison. Keep the instructional answer separate until the first attempt is complete.

You can adapt the wording below to an approved tool that accepts the relevant files. File support and account limits vary, so do not promise that every assistant will import or calculate the pack in the same way.

Prompt to try
Use matching-rules.md and the three matching source CSVs. Produce one review row per invoice RowID. Confirm exact vendor/order/line, SKU, currency and unit before price comparisons. Identify repeated invoice identities without deleting rows. Aggregate only the selected receipts and list their ReceiptIDs. Separate ordered quantity, selected received quantity, billed quantity, unit-price difference and line-price variance. A missing receipt row is missing evidence, not proof of zero delivery. State that no prior invoices exist only because the exercise rules say so. Preserve source amounts. Return unresolved checks and a specific next question. Do not approve, post or pay any invoice.

Check the results row by row, then inspect the exceptions

Begin with the six RowIDs. A five-row answer may have silently removed the copy, while seven or more rows may indicate that multiple receipts multiplied an invoice. Inspect how the tool represented the duplicate group and whether both source references remain available.

Then check the numerical controls. I101 needs a three-unit receipt gap; I102 needs a USD 4.00 price variance. I103 must retain a missing-receipt finding, and I104 must retain a missing-order finding. The two I100 observations require a duplicate review even though their underlying price and selected quantity align.

Recalculate the small examples yourself. Ten times five is USD 50. Eight times twelve is USD 96. Twenty times 2.20 is USD 44. Those are stated line extensions, not a combined payment total. Mixing the repeated source into a grand total before resolving identity would answer the wrong question.

If the output differs, locate whether the problem began in extraction, key selection, receipt aggregation, arithmetic or interpretation. That diagnosis tells you whether to improve the source, revise the prompt or use a more structured matching process. A polished explanation alone cannot resolve the discrepancy.

Make the exception register useful to the next reviewer

A useful handoff names the source row, the unresolved check and the next evidence needed. For I101, request confirmation of the remaining three folders or an approved receipt allocation. For I102, request the applicable price terms or a corrected source. For I103 and I104, request the missing receipt or order reference respectively.

Add a reviewer, review date, decision and supporting reference in fields separate from the AI output. Until a person has accepted responsibility, label an owner as proposed rather than assigned. Keep statuses narrow, such as awaiting receiving evidence or awaiting price clarification, instead of a broad approved label.

When a corrected document arrives, preserve the earlier result and rerun the affected comparison. Record which source changed and whether it resolves the original exception. A correction to quantity should not silently erase an unrelated price question or the duplicate-source trail.

For recurring volumes, evaluate the organization's finance system or a purpose-built document workflow against representative cases, including prior billing and returns. This tutorial gives you a small reference exercise and a disciplined review pattern. Its value is that another person can reproduce the checks and see exactly where the evidence stops.

Related guide: Compare supplier prices and missing terms before ordering

Don't stop here

What to read next

Hand-picked guides our readers explore right after this one.