Case Study: Real-Time Automated Invoice Approval

1. Business Context

A global organization specializing in OCR, business automation, and data engineering needed a system to automatically approve or reject supplier invoices by matching them against existing purchase orders.

2. Problem Statement

Invoices are sent by suppliers using inconsistent product names. Each invoice needs to be validated against one or more purchase orders to ensure the correct items, quantities, and organizational units were billed. Partial deliveries and reuses of PO numbers further complicate validation. Manual checks were slow and error-prone.

3. Solution Architecture

We designed a fully asynchronous, microservice-based architecture. The system listens in real-time to Kafka topics where OCR-parsed invoice XMLs are streamed. The central Orchestrator service coordinates the workflow, delegating tasks to stateless services:

  • Product Matcher: Performs fuzzy (Levenshtein) matching to identify invoice items.
  • PO Retriever: Fetches the current balance of related POs from Elasticsearch.
  • Decision Maker: Evaluates business rules to determine invoice approval or rejection.

Each step is managed by the Orchestrator, which uses an internal repository and state machine to handle recovery and process continuation. The final decision is sent to a Kafka topic (Approve/Reject), used by downstream systems.

4. Key Characteristics

  • Fully asynchronous and stateless communication between services
  • Central orchestration with recovery capabilities
  • Real-time processing using Kafka (input/output)
  • Elasticsearch is used to retrieve PO data
  • Decoupled microservices ensure maintainability and scalability
  • No direct communication between Product Matcher and PO Validator – all interactions go through the Orchestrator

5. Outcome

The system automated the invoice approval process, reducing processing time from hours to seconds. The fuzzy matching ensured high accuracy despite naming inconsistencies. Human involvement was eliminated, resulting in fewer errors and a consistent audit trail. The client continued to expand the platform after delivery.

High‑level architecture (JWT + LDAP auth; REST between React/Express and Application Server, and between Workers and Application Server).

Share the Case Study:

We'd Love To Hear From You