Match purchase orders to invoices
Build a Riff agent that matches purchase orders to invoices, flags GR/IR discrepancies, and keeps your three-way match clean.
Best fit: Agent ERP systems: Infor LN / M3, SAP S/4HANA, Oracle ERP Cloud, Microsoft Dynamics 365 Time to build: ~30 minutes
What you're building
A Riff agent that performs three-way matching — purchase order to goods receipt to supplier invoice — and flags discrepancies before they reach the payment run. Your accounts payable team stops reviewing every invoice manually; they review only the ones the agent can't resolve automatically.
What you need
Riff workspace with your ERP connected
Read access to purchase orders, goods receipts, and incoming invoices
Write access to add notes or hold invoices for review
Defined tolerance thresholds (e.g. accept price variance up to 2%, quantity variance up to 5%)
Step 1: Define the matching rules
Write down your matching logic before you brief the agent:
Matching criteria: PO number on invoice + matching line items + quantity within tolerance
Price tolerance: e.g. invoice price must be within 2% of PO price
Quantity tolerance: e.g. invoice quantity must match GR quantity within 5%
What to do on match: approve for payment (or flag for scheduled payment run)
What to do on mismatch: hold invoice, add note with discrepancy detail, alert AP team
Step 2: Create the agent
Click + New → Agent
Name it — e.g. "PO Matching Agent"
In the Profile tab:
You process incoming supplier invoices in [ERP]. For each invoice, you check it against the corresponding purchase order and goods receipt (three-way match). If the invoice price is within 2% of the PO price and the quantity matches the GR within 5%, you approve the invoice for the next payment run. If the discrepancy is outside tolerance, you hold the invoice and add a note explaining the specific mismatch. You then alert the AP controller with a summary of held invoices.
Step 3: Connect your ERP
Each ERP handles GR/IR differently:
SAP S/4HANA: GR/IR clearing account (transaction MR11), Logistics Invoice Verification (MIRO)
Infor LN: Purchase order receipts matched against purchase invoices in the PO module
Oracle ERP Cloud: Receipt accounting and payables matching via the Financial Orchestrator
Dynamics 365: Invoice matching in Accounts Payable → Vendor invoices
Connect your ERP in the Integrations tab and test that the agent can read invoices, POs, and GRs.
Step 4: Set the trigger
Schedule: run after your ERP's daily invoice processing batch (e.g. daily at 19:00)
Real-time: add an integration event trigger if your ERP supports invoice-received webhooks
Step 5: Test with a sample
In the Chat tab:
Show me the five most recent invoices and their matching statusPick one matched and one unmatched invoice
Run a three-way match on invoice INV-XXXXX— confirm the output is correctCheck that discrepancies are flagged and notes are added correctly
What good looks like
AP team only touches invoices with genuine discrepancies
Every matched and held invoice has a note in your ERP explaining why
Held invoices are cleared (or escalated) before the payment run
The agent's Activity log is the audit trail — every match decision is logged
Variations
If invoices arrive by email (PDF): Add an email trigger. The agent reads the PDF, extracts invoice data, and runs the match.
If your ERP auto-books GRs at a time lag: Add a buffer (e.g. don't match invoices arriving within 24 hours of the PO — wait for the GR to land).
If you have multiple legal entities: Brief the agent with entity-specific tolerances and route escalations to the correct AP controller per entity.
Last updated
Was this helpful?