PayTool Technical Reference

Specifications for CSV batch parsing, minor-unit arithmetic, exception classification, and Team REST endpoints.

CSV input schema

Both processor payout files and bank ledger exports must be encoded as UTF-8 CSV (BOM optional) up to 2 MB and 10,000 rows in browser memory, or up to 250,000 records/month via Team API ingestion.

id,date,reference,amount,currency,description
PAY-4108,2026-10-12,INV-2026-4108,4820.00,USD,Alder Wholesale settlement
PAY-4109,2026-10-12,INV-2026-4109,1940.25,EUR,Northgate Freight batch

Unique IDs are enforced per file. Dates use strict ISO YYYY-MM-DD validation. Supported currency codes span 147 active ISO 4217 entries.

BigInt minor-unit arithmetic

IEEE-754 floating-point subtraction drops fractions across large settlement sums. PayTool splits each decimal string at the radix point, pads the fractional segment to six decimal places, and stores every balance as a signed 64-bit+ BigInt integer.

const [whole, fraction = ""] = value.split(".");
let units = BigInt(whole.replace("-", "") + fraction.padEnd(6, "0"));
if (value.startsWith("-")) units = -units;

Five outcome codes

CodeClassificationRule condition
exactMatched1:1 reference across both files with identical currency and 0n minor delta.
amountNeeds review1:1 reference and matching currency, non-zero minor-unit variance (e.g. wire fee).
currencyNeeds review1:1 reference across files where settlement currency differs from ledger currency.
missingNeeds reviewReference exists in only one dataset without a counterpart entry.
ambiguousNeeds reviewTwo or more rows share a reference ID within the same source dataset.

Audit export & sanitization

Every exported close CSV includes a UTF-8 BOM for spreadsheet compatibility, quotes every cell per RFC 4180, and prepends an apostrophe to any string beginning with =, +, -, @, tab, or carriage return after control whitespace.

Team REST API & AWS infrastructure

Team ($49/month) and Scale ($149/month) workspaces automate ingestion from Stripe, Adyen, Revolut, Xero, and QuickBooks using AWS Lambda workers, KMS-encrypted S3 archive buckets, and per-tenant RDS ledger state.

POST https://api.paytool.space/v1/batches/reconcile
Authorization: Bearer <workspace_api_token>
Content-Type: application/json

{
  "entity": "us-treasury",
  "payments_uri": "s3://paytool-vault-us/oct-stripe.csv",
  "ledger_uri": "s3://paytool-vault-us/oct-bank.csv",
  "strict_bigint": true
}