Bills, contracts and ledgers logo

Exact Ledger Reconciler

$1.50 USDC per call · Business, finance and compliance · POST /api/v1/reconcile-ledger · Id reconcile-ledger

Explains which charges, refunds and fees make up a Stripe, PayPal or bank payout, with an exact solver instead of a model: subset-sum over integer minor units (meet-in-the-middle, DP, branch-and-bound) across candidate fee schedules (percentage + fixed, tiers, caps), withholding, FX rates and rounding conventions (half-up, half-even, truncate; per line or on the total). Paste a Stripe balance or payout-reconciliation CSV, a PayPal activity CSV or structured rows. verdict.action is RECONCILED, MATCHED_WITH_UNSETTLED_ITEMS (every payout explained, some items belong to a later payout), AMBIGUOUS (with the exact count), UNMATCHED_SETTLEMENTS (missing items, phantom payouts and the closest near-miss) or SEARCH_INCOMPLETE. Reports which rounding convention reconciles and a hash-chained audit trail. Structured input, CSV and plain one-amount-per-line statements make zero LLM calls; other free text is normalized by a fast-tier LLM whose rows must quote the source verbatim. Not accounting or tax advice.

What you get

Finance teams and agents stop trusting a model's arithmetic: every matched payout, residual and ambiguity count is recomputable from a hash-chained audit trail.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/reconcile-ledger. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/reconcile-ledger \
  -H 'content-type: application/json' \
  -d '{"text":{"items":"id,Type,Amount,Currency,Created (UTC)\nch_1,charge,100.00,usd,2026-10-01 09:12:44\nch_2,charge,250.00,usd,2026-10-01 14:03:10\nch_3,charge,40.00,usd,2026-10-02 08:45:31\nre_1,refund,25.00,usd,2026-10-02 16:20:05","settlements":"id,Amount,Currency,Arrival Date\npo_1,314.25,usd,2026-10-05"},"feeSchedules":[{"id":"stripe_us_card","rules":[{"percent":"2.9","fixed":"0.30"}]}]}'

Input

FieldTypeRequiredDescription
itemsarray<object>; max 2000 itemsnoLedger lines. Amounts are signed (refunds and disputes negative) strings in major units, e.g. "1234.56".
settlementsarray<object>; max 200 itemsnoPayouts or bank settlement totals to explain.
feeSchedulesarray<object>; max 20 itemsnoCandidate fee schedules; the solver reports which one reconciles each settlement. Omit for no fees.
withholdingsarray<object>; max 20 itemsno
fxRatesarray<object>; max 500 itemsnoDirect rates only (1 from = rate to). The latest rate dated on or before the reference date applies; an undated rate is the fallback.
textobjectnoMessy source text for collections not given structurally. A CSV with a header (Stripe balance or payout-reconciliation export, PayPal activity export, bank statement) is parsed by code with no model, and so are headerless lines with one amount each (date, id, amount, currency, and wording that names one kind, such as Payment or Refund); anything else goes to a fast-tier LLM that must quote every row verbatim.
defaultCurrencystring; length 3..3noCurrency for text rows that state none.
crossCheckbooleannoRun two independent LLM translations and keep only rows both produced (default true).
conventionsobjectnoRestrict the conventions searched (default: all rounding modes x both scopes x both FX date policies).
toleranceMinorinteger; 0..1000000noAccepted |residual| per settlement in minor units (default 0 = exact).
nearMissToleranceMinorinteger; 1..1000000000noLargest residual searched when reporting the closest near-miss for an unmatched settlement.
maxLagDaysinteger; 0..3650noAn item may settle at most this many days after its date.
limitsobjectno

Example request body

{
  "text": {
    "items": "id,Type,Amount,Currency,Created (UTC)\nch_1,charge,100.00,usd,2026-10-01 09:12:44\nch_2,charge,250.00,usd,2026-10-01 14:03:10\nch_3,charge,40.00,usd,2026-10-02 08:45:31\nre_1,refund,25.00,usd,2026-10-02 16:20:05",
    "settlements": "id,Amount,Currency,Arrival Date\npo_1,314.25,usd,2026-10-05"
  },
  "feeSchedules": [
    {
      "id": "stripe_us_card",
      "rules": [
        {
          "percent": "2.9",
          "fixed": "0.30"
        }
      ]
    }
  ]
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
verdictobjectnoMachine-readable call, computed in code. Leads the answer; detail follows in the other fields.
disclaimerstringnoNot financial advice.
statusstring; one of "UNIQUE", "AMBIGUOUS", "NO_EXACT_MATCH", "BUDGET_EXCEEDED", "INSUFFICIENT_INPUT"noUNIQUE only when the search completed and exactly one assignment exists.
deterministicbooleannoTrue when no LLM touched the verdict path (structured, CSV or line-grammar input).
reconciledbooleannoEvery settlement matched and no item left unsettled.
summaryobjectno
solutionone ofnoThe recommended assignment (lowest date lag among the reported solutions); null when no settlement matched.
alternativesarray<object>no
ambiguityobjectno
conventionsobjectnoWhich rounding mode / scope / FX policy reproduces the settlements.
discrepanciesobjectnoUnsettled items, phantom settlements, residuals, closest near-misses.
budgetobjectno
auditobjectnoSolver, budgets, statistics, canonical input hash and the hash-chained step list.
translationobjectno
notesarray<string>no

Pay and connect

Available through: x402 (USDC on Base), MCP, RapidAPI, Apify.

Machine-readable