Invoicing · 01 / 26

Invoicing and Collections: A Receivables Platform

A complete, generic AI (artificial intelligence) platform for customer invoicing and collections: billing checks, cash application, disputes and collections, with architecture, AI gateway, Databricks, Prisma AIRS, Microsoft Foundry and LangSmith, end to end.

The scenario

Example Industrial Supply (fictional) distributes parts to about 8,000 business customers and issues around 60,000 invoices a month by EDI (Electronic Data Interchange), e-invoice networks, email and a customer portal. Billing runs overnight. Customers pay by bank transfer and lockbox, often with a remittance advice that lists what the payment covers, sometimes with deductions and short pays. Today days sales outstanding is 52, about 4% of cash sits unapplied for days, and one invoice in nine is disputed. Collectors work from aging reports and spreadsheets.

The goal is a receivables platform that catches billing errors before an invoice goes out, matches incoming cash to invoices without keying, resolves disputes with evidence, and tells collectors who to contact and what to say, with a person deciding every credit, write-off and escalation. This is the customer-facing side of the money, the receivables mirror of the accounts-payable example elsewhere in AI Learning.

Everything here is fictional and illustrative: the company, customers, invoices, amounts, tolerances, thresholds and targets are invented. Vendor product names are real; code and configuration are sketches that show the shape of an integration. Check endpoints, parameter names and feature availability against each vendor's current documentation before you build.

See also the accounts-payable example in AI Learning, which handles the supplier side.

Architecture

Architecture of the receivables platform Orders, contracts and usage feed a deterministic billing engine that prices, taxes and checks credit, and invoices are delivered by EDI, e-invoice network, email or portal. Bank files and remittance advice feed cash application, which matches payments to open invoices with rules and scoring and posts to the ERP and ledger. Exceptions go to a dispute agent and a collections agent, and every unclear case reaches a review desk. Model calls pass through an AI gateway and enterprise systems through a tool gateway. Traces and evaluations land in the lakehouse. INVOICE Billing sources orders · contracts · usage Billing engine price · tax · credit rules Delivery EDI · e-invoice · email · portal CASH Bank and remittance camt.053 · lockbox · email Cash application rules + match scoring ERP and ledger AR subledger · GL EXCEPTIONS Dispute agent RAG + tools Collections agent priority + drafts Review desk clerks · collectors PLATFORM AI gateway scans · routing · budgets Tool gateway (MCP) scopes · policy · audit Lakehouse traces · evals · UC send match post exceptions deterministic service gateway or engine agent human decision
Four layers: invoicing, cash, exceptions and the shared platform. Models and enterprise systems are reached only through the two gateways.

Billing is deterministic: pricing, tax and credit checks are code with tests. Models read documents, spot anomalies against contract terms, retrieve the governing clause and draft explanations. A person decides anything that changes what a customer owes.

One payment, with what happens behind it

A payment with a remittance advice and a short pay, from arrival to posting. The right-hand column is what the platform does.

StepWhat happensBehind the scenes
Bank fileA payment of $48,720.00 from Acme Fabrication arrives in the morning bank file with the reference ACME-OCT-W2.Parsed from camt.053. The customer is identified by account number and name.
RemittanceAn emailed PDF (Portable Document Format) lists seven invoices. Six are paid in full. Invoice INV-81234 is short by $620.00 with the note "damaged in transit".Document AI extracts the lines as JSON (JavaScript Object Notation) that must validate against the remittance schema.
MatchSix invoices match exactly. The payment total equals the sum of the lines.Rules match on invoice number and amount. A scoring model ranks anything ambiguous.
Short payThe $620.00 short pay is above the $50.00 tolerance, so it is not written off.A deterministic rule creates an exception. The platform never writes off by itself.
InvestigateThe dispute agent finds the delivery receipt, a carrier damage note, and clause 9.2: damage claims within five days.Tool calls through the gateway read orders, proof of delivery and claims. Retrieval returns the clause with a citation.
DecideThe agent drafts: apply $48,100.00 now, open a $620.00 dispute, recommend a credit pending the carrier claim. A collector approves the dispute and leaves the credit to the credit manager.Credits above $500.00 need the credit manager. The decision is recorded with the evidence.
PostCash is applied to the six invoices and the partial invoice. The customer gets a clear note about the open $620.00 item.Posted to the ERP (Enterprise Resource Planning) with an idempotency key. Full trace written to the audit store.

The parts, and where each is covered

Billing checks

Deterministic pricing, tax and credit rules, with an anomaly check against contract terms before release.

Cash application

Bank files and remittance advice matched to open invoices by rules and scoring, with unclear cases to a person.

Dispute agent

Gathers evidence through tools, retrieves the governing clause and drafts a resolution for a person to approve.

Collections agent

Ranks accounts by risk and value and drafts outreach in the right tone, for a collector to approve.

Platform

The AI gateway, tool gateway, lakehouse, security scanning and telemetry shared by every agent.

Assurance

Threat model, evaluation plan, governance and runbooks that make it safe to run on money.

Design and delivery documents

The documents an architecture review, a security review, a finance review and an operations team would ask for, each written for this platform.

Requirements and targets

These are the requirements the design was built against. The targets are planning figures for this demo, not measured results.

AreaRequirementIllustrative target
Invoice accuracyPrices, tax and terms checked against contract before releaseBilling-error credits down by half
Cash applicationPayments matched to invoices from bank and remittance dataAt least 92% of payment value applied without a person
Unapplied cashUnmatched payments found and resolved quicklyUnder 1% of cash unapplied after two days
DisputesEvidence gathered and a cited resolution draftedMedian time to resolve cut by a third
CollectionsAccounts ranked by risk and value, outreach draftedDays sales outstanding down by five days
ControlNo credit, write-off or posting by a model alone100% of credits and write-offs carry a human approval
SecurityRemittance, email and tool traffic scannedScan on 100% of model and tool traffic
PrivacyCustomer contacts and bank details minimised and maskedNo raw bank account numbers in analytics tables
AuditEvery match, credit and posting traceableComplete trace for 100% of posted items

Suggested reading order

  1. Business user stories

    Start with who the platform serves and what each of them needs.

  2. ADRs (Architecture Decision Records)

    Read the decisions that set the shape of the platform.

  3. Sequence diagrams

    Follow the key flows step by step across the components.

  4. Diagram gallery

    See the most pertinent diagrams from every page in one place.

  5. Design documents

    Data model, tool contracts, integration map and non-functional requirements.

  6. AI gateway

    See how developers reach models through one governed front door.

  7. Databricks

    See where data, knowledge, serving and evaluation live.

  8. Prisma AIRS

    See how every prompt, document and tool call is scanned.

  9. Foundry

    See the platform on Microsoft's agent platform.

  10. LangSmith

    See the platform on LangGraph with tracing and evaluation.

  11. Telemetry

    See how every unit of work is traced and measured, with queries operators use.

  12. Assurance

    Threat model, evaluation plan and governance: how it is shown to be safe and good.

  13. Delivery

    Cost model, rollout, agile plan and runbooks for running it.

Build this for your business

This example is a receivables platform for a distributor, but the same pattern, deterministic financial rules, a governed gateway, runtime security, grounded evidence and measured quality, fits any back-office process that moves money. We can scope a pilot on your own systems.

Book a discovery call