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
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.
| Step | What happens | Behind the scenes |
|---|---|---|
| Bank file | A 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. |
| Remittance | An 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. |
| Match | Six 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 pay | The $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. |
| Investigate | The 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. |
| Decide | The 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. |
| Post | Cash 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.
- Business user stories: Personas, epics, acceptance criteria and a release plan.
- Architecture decisions: The nine decisions behind the shape of the platform.
- Sequence diagrams: Invoice run, delivery, cash application, unmatched payment, disputes and dunning.
- Diagram gallery: The pertinent diagrams in one place.
- Data model and classification: Entities, classification and retention.
- Tool and API (Application Programming Interface) contracts: The tool catalogue, OpenAPI and MCP (Model Context Protocol) definitions.
- Integration map: ERP, billing, bank, tax, CRM and delivery networks.
- Non-functional requirements: Performance, availability, month-end capacity and recovery.
- Threat model: Payment fraud, remittance injection and data exposure.
- Evaluation plan: Datasets, metrics and release thresholds.
- Responsible AI and governance: Oversight, regulation and model risk.
- Cost and FinOps model: Cost per invoice and per matched payment.
- Rollout and operating model: Phases, gates and responsibilities.
- Agile delivery plan: Two-week sprints, roadmap and capacity.
- Runbooks and incident playbooks: Wrong invoices, misapplied cash and outages.
- References and further reading: Standards, documentation and papers.
Requirements and targets
These are the requirements the design was built against. The targets are planning figures for this demo, not measured results.
| Area | Requirement | Illustrative target |
|---|---|---|
| Invoice accuracy | Prices, tax and terms checked against contract before release | Billing-error credits down by half |
| Cash application | Payments matched to invoices from bank and remittance data | At least 92% of payment value applied without a person |
| Unapplied cash | Unmatched payments found and resolved quickly | Under 1% of cash unapplied after two days |
| Disputes | Evidence gathered and a cited resolution drafted | Median time to resolve cut by a third |
| Collections | Accounts ranked by risk and value, outreach drafted | Days sales outstanding down by five days |
| Control | No credit, write-off or posting by a model alone | 100% of credits and write-offs carry a human approval |
| Security | Remittance, email and tool traffic scanned | Scan on 100% of model and tool traffic |
| Privacy | Customer contacts and bank details minimised and masked | No raw bank account numbers in analytics tables |
| Audit | Every match, credit and posting traceable | Complete trace for 100% of posted items |
Suggested reading order
Business user stories
Start with who the platform serves and what each of them needs.
ADRs (Architecture Decision Records)
Read the decisions that set the shape of the platform.
Sequence diagrams
Follow the key flows step by step across the components.
Diagram gallery
See the most pertinent diagrams from every page in one place.
Design documents
Data model, tool contracts, integration map and non-functional requirements.
AI gateway
See how developers reach models through one governed front door.
Databricks
See where data, knowledge, serving and evaluation live.
Prisma AIRS
See how every prompt, document and tool call is scanned.
Foundry
See the platform on Microsoft's agent platform.
LangSmith
See the platform on LangGraph with tracing and evaluation.
Telemetry
See how every unit of work is traced and measured, with queries operators use.
Assurance
Threat model, evaluation plan and governance: how it is shown to be safe and good.
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