How to Reconcile Payments with Claude Code and Codex
Build a payment reconciliation agent with Claude Code or Codex. Explain bank, processor, and ledger differences, then prepare reviewed adjustments in Runtime.
A payout doesn't match the ledger. Someone exports a bank statement, downloads the processor report, and starts looking for the difference. Part of it may be timing. Part may be a fee. One unmatched item can keep returning in tomorrow's report because nobody has documented what it actually is.
The useful job for an agent is to explain the break and prepare the next step. That means preserving the source records and the arithmetic, not just making two totals look equal.
This guide shows how to build a payment reconciliation agent with Claude Code or Codex and run it in Runtime. The agent investigates exceptions across bank, processor, and ledger data. Your operations or finance reviewer approves any correction.
The short answer. Define the accounts, currencies, periods, and matching rules for one reconciliation. Give the agent read access to the relevant source records. Have it identify candidate matches, explain differences with reproducible calculations, and prepare a proposed resolution. Keep forced matches, write-offs, journal posting, and money movement behind separate authorization.
Choose the reconciliation
Start with one source pair or one well-defined three-way comparison. Processor-to-bank settlement reconciliation, internal ledger reconciliation, and customer-level balance reconciliation answer different questions.
| Comparison | Main question |
|---|---|
| Processor to bank | Does the settlement batch explain the actual payout? |
| Bank to internal ledger | Is the bank movement represented correctly in our books? |
| Expected payment to received payment | Did the amount arrive, including split or combined payments? |
| Suspense-account exception | What does this open item represent and who can resolve it? |
Define whose records the agent may change, if any. Synctera's reconciliation documentation, for example, separates fintech reference access from bank or platform manual reconciliation work. Reading a bank-side discrepancy doesn't establish authority to edit that bank's ledger.
Walk through a break
In the fictional example below, the exception totals $43,050. The investigation finds $41,800 associated with unsettled timing and a $1,250 fee that hasn't been posted internally. The agent drafts the fee adjustment and leaves both items for the appropriate review.
The morning bank file and ledger differ by $43,050. Can you trace the variance and prepare the next steps?
- Approved reads
- I’ll compare the settlement references, bank activity, and ledger entries. Any adjustment will stay in draft.
- Handoff
- Prepare evidence and a draft. Your reviewer decides the next action.
- ColumnRead the bank activity file$43,050 variance against the ledger
- StripeMatched settlement referencesOne batch pending bank settlement
- Modern TreasuryChecked the pending batch$41,800 timing difference
The $43,050 difference consists of a $41,800 batch still awaiting bank settlement and a $1,250 fee missing from the ledger. I prepared a settlement follow-up and a fee-entry draft with source references. No entries have been posted.
Reconciliation review ready
$43,050 variance · timing difference and unposted fee
- $41,800 settlement timing identified · follow-up
- $1,250 fee entry drafted · review required
- No ledger entries posted · read-only
The arithmetic is straightforward: $41,800 plus $1,250 explains $43,050. The evidence is what makes the explanation useful. The timing component still needs follow-up, and the fee entry still needs approval.
The stack
Use the reports and ledgers your team reconciles today. These are example systems. Confirm the available connection, report format, data coverage, and permissions during setup.
| Job | Example tools |
|---|---|
| Retrieve bank activity | |
| Read processor settlements | |
| Read expected payments and matching rules | |
| Check internal entries | Your scoped ledger or warehouse |
| Prepare accounting adjustments | |
| Agent infrastructure |
Runtime holds the specialized agent's environment and execution record. The source systems remain authoritative, and the accounting system records approved entries. See the payment operations solution for the complete review flow.
Step 1: Define a match
Write down the account, currency, reporting period, cutoff timezone, source identifiers, and matching rules. Be explicit about gross versus net amounts and which dates matter for each source.
Prefer stable references over amount-only matching. Modern Treasury's reconciliation rules describe different matching strategies, including one-to-many and many-to-one relationships. Your procedure should state which relationships are valid for this reconciliation.
| Rule detail | Why it matters |
|---|---|
| Currency | Equal numbers in different currencies aren't equal amounts |
| Stable transaction or batch reference | Prevents accidental matches between similar payments |
| Gross and net definitions | Separates fees and adjustments from missing funds |
| Date and timezone | Explains which records belong in the period |
| Matching cardinality | Allows an approved batch or installment relationship |
| Tolerance | Requires an explicit policy and a visible explanation |
Have finance approve the tolerance and resolution rules. An agent should never create its own threshold for writing off a difference because the number looks small.
Step 2: Create the agent with Claude Code or Codex
Start with sanitized bank, processor, and ledger extracts from a completed period. Include the matching procedure and one good exception note.
Build a reconciliation investigation agent for these approved accounts and this reporting period. Read the bank, processor, and ledger records through scoped tools. Match using our reviewed identifiers and rules, preserve source values, and explain each remaining difference with reproducible calculations. Produce candidate matches, unresolved items, and draft adjustments for review. Don't post journals, force matches, write off differences, or move money.
Ask the coding agent to create separate helpers for importing reports, normalizing fields, applying approved matching rules, and building the exception packet. Keep monetary calculations in reviewed code with explicit currency and rounding rules. The language model can explain the results after those calculations run.
Review Claude Code permissions or Codex security controls for your chosen implementation. Use read-only source credentials and a separate draft destination.
Keep the original extracts and their retrieval times. If the processor later corrects a report, the reviewer should be able to see which version produced the original finding.
Step 3: Explain the difference
Have the agent classify each exception under your approved categories: timing, fee or adjustment, missing internal entry, duplicate record, incorrect reference, or unresolved difference. Each classification needs evidence.
Stripe's payout reconciliation report distinguishes settled payout batches from unsettled ending balances. Check whether the report is appropriate for your payout setup before building your workflow around it.
In the sample case, the agent must link the $41,800 timing component to the relevant records and explain why it remains unsettled. It must separately identify the $1,250 fee and show that the internal ledger hasn't already recorded it.
Investigate the $43,050 exception. Break it into supported components using the original source references. Show the calculation for each component and the evidence for its classification. For a timing item, state the next check and its owner. For a missing fee entry, prepare a draft with the proposed accounts and supporting record. Leave unresolved items open.
Avoid treating "timing" as a permanent resolution. Give that item a follow-up point under your procedure. If the expected event doesn't occur, the case should return for investigation with its prior explanation attached.
Step 4: Prepare the resolution
Produce a packet the reviewer can act on without rebuilding the comparison.
| Packet field | What belongs there |
|---|---|
| Exception reference | Stable case ID and reconciliation period |
| Source records | Bank, processor, and ledger references with report versions |
| Difference | Amount, currency, and calculation |
| Explanation | Supported category and remaining uncertainty |
| Proposed action | Draft entry, requested correction, or follow-up check |
| Owner and approval | The team authorized to make that change |
For a draft journal, include the proposed debit and credit accounts, amount, currency, effective date, and source evidence. Validate that the draft balances using reviewed accounting logic. Your finance team still approves whether the proposed treatment is appropriate.
Keep a requested bank correction distinct from an internal accounting entry. Those actions belong to different owners. The agent should route the request with supporting evidence instead of claiming that it fixed an external ledger.
Step 5: Run the close cycle
Create a Runtime template for the selected reconciliation. Add the approved helpers, procedure, and output format. Supply credentials through the approved secrets interface.
Trigger the agent only after the required source files or feeds are available. Define what "available" means: report period, completion marker, retrieval time, and expected coverage. A run against half a settlement file can produce a convincing but incomplete exception list.
Use a stable reconciliation key containing the account, currency, period, and source version. A repeated run should link to the existing case or create an explicit revision. It should not create duplicate proposed adjustments.
For suspense items, keep the original age and ownership visible across runs. A new investigation date must not make an old unresolved balance look new. Escalate according to the team's aging procedure.
Test the edge cases
Build a test pack that checks arithmetic, matching, and operational boundaries.
| Test | Expected behavior |
|---|---|
| Two payments have the same amount | The agent requires the approved identifying evidence |
| A payout covers several transactions | The approved batch relationship is preserved |
| A fee was already posted | No duplicate adjustment is proposed |
| A report is incomplete | The run states the coverage gap and remains incomplete |
| The currencies differ | The agent avoids an unsupported direct match |
| A prior period is rerun | The same source version produces a consistent result |
| A prompt asks for a write-off | The agent has no permission to execute it |
Include a timing item that never settles as expected. Confirm that the workflow reopens or escalates it instead of repeatedly accepting the old explanation.
Test the reviewer experience too. The exact figures in the packet should reconcile to the attached records, and every proposed action should name its owner.
Measure resolved work
Track time to an explained break, reviewer effort, unresolved-item age, reopened cases, and duplicate adjustment proposals. Separate explained timing items from fully resolved exceptions.
Measure the value of open items alongside their count. Clearing many small exceptions can make the queue look healthier while a large unexplained balance remains untouched.
Use the reviewed pilot to decide whether to expand to another account or reconciliation type. Keep the assumptions explicit when you do. A workflow that handles one processor's net payouts may need different rules for another source.
When an exception turns into a bank information request, keep it linked to the partner-bank request workflow. Both teams should be able to see the same supporting references.
Frequently asked questions
How do I reconcile payments with Claude Code?
Use Claude Code to build reviewed import, matching, and calculation helpers for one defined reconciliation. Give the agent scoped access to bank, processor, and ledger records, then have it explain exceptions and prepare source-linked proposals for finance review.
Can Codex investigate suspense-account exceptions?
Yes, you can use Codex to build a workflow that traces an open item to its source records, explains the difference, and assigns the next action. Preserve the item's original age and leave unresolved balances open for the authorized owner.
Should an AI reconciliation agent post journal entries?
Start with draft-only adjustments. Posting needs a separately authorized workflow with reviewed accounting rules, duplicate protection, current-state checks, and the required approvals. A matching explanation alone doesn't authorize an accounting change.
The point
An explained break has a calculation, source records, and a next owner. Build the agent to produce those three things, then let the authorized reviewer close the loop.
See a reconciliation exception investigated
Bring a sanitized break and the reports your team checks. We'll map the evidence, draft adjustment, and review process in Runtime.