AI Invoice and Receipt Processing: Extraction Prompts, Validation Rules and Automation Setup
finance automationOCRinvoicesreceiptsXeroQuickBooks

AI Invoice and Receipt Processing: Extraction Prompts, Validation Rules and Automation Setup

DDaily Bot Lab
2026-11-13
6 min read

Build a reliable AI invoice workflow with extraction prompts, JSON fields, validation rules, duplicate checks, human review, and accounting integrations.

Reliable AI invoice processing needs more than OCR. This guide provides a reusable workflow for collecting invoice and receipt files, extracting structured data, checking tax and payment details, matching suppliers, detecting duplicates, routing exceptions, and approving records before they reach Xero, QuickBooks, Airtable, or an ERP.

Overview

AI invoice processing combines document capture, OCR, language-model extraction, business rules, and human approval. The safest design treats AI as a data-entry and classification assistant rather than the final accounting authority.

A practical workflow looks like this:

  1. Collect: Receive PDFs or images from an accounts-payable inbox, cloud folder, upload form, or scanning process.
  2. Identify: Separate invoices, receipts, credit notes, statements, and unsupported documents.
  3. Extract: Read the document and return fields in a fixed JSON structure.
  4. Validate: Check totals, dates, currencies, VAT or sales-tax fields, supplier details, and required references.
  5. Match: Compare the supplier against an approved vendor list and, where available, match the invoice to a purchase order or receipt.
  6. Review: Send low-confidence or failed records to a human review queue.
  7. Export: Create a draft bill or approved accounting record only after the required checks pass.

Keep the original file, extracted data, validation results, reviewer decision, and export identifier together. This creates a useful audit trail and makes it easier to correct prompts or rules without losing the source document.

Checklist by scenario

1. Supplier invoices received by email

  • Create a dedicated intake address or mailbox folder for invoices.
  • Save attachments to a controlled cloud-storage location with a unique file ID.
  • Reject or quarantine password-protected, corrupted, or unsupported files.
  • Record the sender, received time, filename, and source message.
  • Run extraction and validation before creating a draft bill in the accounting system.

A Zapier or Make.com AI workflow can connect an inbox, cloud storage, an extraction step, a spreadsheet or Airtable review table, and an accounting application. The exact modules and supported file types should be checked in the current product documentation before deployment.

2. Receipts and small purchases

  • Accept clear phone images as well as PDFs, while preserving the original image.
  • Extract merchant, transaction date, total, tax, currency, payment method, and expense category.
  • Mark missing merchant names, unreadable totals, and ambiguous dates for review.
  • Ask the submitter for a business purpose or project code when required by internal policy.
  • Prevent a receipt from being posted as an invoice unless the document type is confirmed.

Receipts often contain less consistent information than invoices. Use a lower automation threshold and require manual confirmation when the merchant, tax amount, or currency cannot be read confidently.

3. Purchase-order matching

  • Extract the purchase-order number when present.
  • Compare supplier, line items, quantities, unit prices, tax, and total against the purchase order.
  • Define acceptable variance rules with the finance team instead of allowing the model to invent them.
  • Route missing purchase orders or mismatched totals to an exception queue.

4. Direct export to accounting software

  • Map extracted fields to the target system's required fields.
  • Use a draft or pending state where available rather than posting automatically.
  • Map suppliers, chart-of-accounts codes, tax rates, tracking categories, departments, and currencies from controlled lookup tables.
  • Store the accounting-system record ID after export.
  • Retry temporary integration failures without creating duplicate records.

Reusable extraction prompt

Use a structured prompt like this as a starting point, then test it against representative documents:

You are an invoice and receipt data-extraction assistant. Read only the supplied document. Do not guess or calculate values that are not supported by visible evidence. Return valid JSON matching the schema below. Use null for missing or unreadable values. Preserve the document's currency and date meaning. Set document_type to invoice, receipt, credit_note, statement, or unknown. Include a confidence value from 0 to 1 for each extracted field and list any uncertainty in warnings.

Pair the instruction with a strict response schema:

{
  "document_type": "invoice",
  "supplier": {"name": null, "tax_id": null, "address": null},
  "invoice_number": null,
  "invoice_date": null,
  "due_date": null,
  "purchase_order_number": null,
  "currency": null,
  "subtotal": null,
  "tax_amount": null,
  "total": null,
  "tax_rate": null,
  "line_items": [{"description": null, "quantity": null, "unit_price": null, "tax_rate": null, "line_total": null}],
  "payment_details": {"account_name": null, "account_number": null, "sort_code_or_routing": null},
  "confidence": {},
  "warnings": []
}

What to double-check

Extraction is only the first control. Apply deterministic checks wherever possible:

  • Arithmetic: Check whether subtotal plus tax equals the stated total, allowing for a documented rounding tolerance.
  • Dates: Confirm that invoice and due dates are valid, consistently formatted, and not accidentally interpreted in the wrong day-month order.
  • VAT or sales tax: Compare the tax amount and rate with the applicable internal rules. Do not infer tax treatment solely from a supplier's wording.
  • Currency: Confirm that the document currency matches the accounting record and that any conversion rate is supplied by an approved process.
  • Supplier: Match normalized supplier names against a controlled vendor table. Treat a new bank account as a review trigger, not an automatic update.
  • Duplicates: Compare supplier, invoice number, date, total, currency, and file hash. A changed filename should not bypass duplicate detection.
  • Line items: Check quantities, unit prices, totals, account codes, and project or department tags where relevant.
  • Evidence: Retain page references, text snippets, or bounding-box coordinates if the chosen document tool supports them.

A spreadsheet or Airtable review table might include: file ID, source URL, document type, supplier, invoice number, invoice date, due date, currency, subtotal, tax amount, total, purchase-order number, duplicate status, validation status, confidence, reviewer, review notes, export status, and accounting record ID.

Common mistakes

  • Posting every successful extraction: Valid JSON does not mean accurate accounting data. Use approval gates.
  • Letting the model calculate missing values: Store null and flag the field unless a separate, testable calculation step is authorised.
  • Using supplier names as the only identity key: Maintain supplier IDs and review near matches.
  • Ignoring credit notes and statements: Classify document type before applying invoice rules.
  • Hard-coding tax assumptions: Keep tax rates and account mappings in a maintained lookup table.
  • Skipping duplicate protection: Check both the document and the destination accounting system before export.
  • Sending sensitive files through unapproved tools: Review retention, access, processing location, permissions, and contractual requirements before connecting a model or automation platform. The AI automation security checklist provides a broader control framework.
  • Launching without test cases: Test clear scans, rotated pages, multi-page invoices, handwritten receipts, foreign currencies, credit notes, duplicate files, and deliberately ambiguous documents. See how to test and monitor AI automation workflows.

For a wider PDF and form-processing pattern, review the AI document processing workflow. Teams building a custom integration can also use the OpenAI API integration guide as a technical companion.

When to revisit

Review this workflow before each major accounting period, seasonal planning cycle, or change to the finance process. Re-test it when suppliers change invoice layouts, tax rules or internal coding rules change, a new country or currency is added, or the connected accounting platform changes its API, file support, permissions, or usage limits.

At each review, sample manually approved invoices and receipts from the previous period. Compare extracted values with the approved records, group errors by field, and update the prompt, lookup tables, validation rules, or review thresholds. Recheck supported file formats, accounting integrations, model capabilities, privacy settings, and pricing or usage limits after major product changes rather than relying on an old setup.

Start with one document source and a review queue. Process a controlled batch, measure which fields require correction, and only then expand to more suppliers or automatic draft creation. The goal is not to remove human judgment from accounts payable; it is to make routine capture faster while keeping exceptions visible and approvals accountable.

Related Topics

#finance automation#OCR#invoices#receipts#Xero#QuickBooks
D

Daily Bot Lab

AI Automation Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.