Back to learn

How AI detects expenses

Capture, extract, match, categorize. The pipeline behind automated expense detection.

Expense detection is the process of identifying a business expense from source documents and matching it to the card or bank transaction that funded it. Modern systems break this into four stages.

Capture

A photo of a receipt, an emailed invoice, or a card transaction feed. Mobile capture with automatic cropping is the standard entry point. The quality of this step sets the ceiling for everything downstream.

Extraction

OCR reads the document, then a field extractor picks out merchant, date, subtotal, tax, tip, total, and any line items. See Receipt OCR explained for the full pipeline. Hybrid language models are now the norm.

Matching

This is the AI-critical step. Given a receipt and a set of unmatched card transactions, decide which transaction (if any) funded the receipt. Amount alone is not enough because two lunches on the same day can be identical. The matcher uses date proximity, merchant name similarity, currency, and MCC to score candidates and pick the best.

Categorization

Once matched, the transaction inherits any category rules already in place. AI helps by suggesting a category for a merchant no rule has seen. The human accepts or rejects; the acceptance becomes a new rule.

Common failure modes

  • Multiple identical charges in a day get matched to the wrong receipt.
  • Foreign transactions get matched to the wrong line because of the FX conversion fee.
  • Refunds get matched to unrelated purchases because amounts and dates align.

Each of these is solved by adding a signal (merchant, MCC, currency, timestamp minute) and by refusing to match when confidence is low. A good expense system prefers a rejected candidate over a wrong match.