-
-
The paperwork check holds back an inflated invoice; Kite's agent holds back a disputed one.
-
Agents negotiate a chain shortcut: yes, no, or yes-if, on the owner's instructions.
-
Settled on PayPal: $42,850 cancelled with no money moved, $14,200 paid.
-
Six businesses, $64,250 of invoices between them. Each has an agent.
Inspiration
Late payment is a chain reaction. A can't pay B until C pays A, and C is waiting on B. In 2026, 59% of US small businesses carry invoices more than 30 days overdue. Much of that debt is circular, and circular debt can be cancelled without money moving. Slovenia and Romania have run national clearing systems on this principle for decades. It never reached ordinary small businesses because every party has to agree at the same moment. AI agents remove that cost.
What it does
Six businesses in one supply chain hold $64,250 of invoices against each other. OFFSET:
- Reads the books from PayPal. Open invoices come from the PayPal Invoicing API.
- Checks the paperwork. An AI checker compares each invoice with its purchase order and delivery record. An inflated invoice whose delivery note tells "any automated reviewer" to approve it gets held back.
- Lets each business's agent speak for its owner. Agents act on instructions the owner wrote in plain English. Kite's agent refuses to settle an invoice for water-damaged stock.
- Cancels the loops. Plain code, no AI. Nobody's net position changes.
- Shortens the chains by negotiation. If A owes B and B owes C, A can pay C directly. That changes who C relies on, so C's agent judges A's payment record and can accept, refuse, or ask for faster payment. A's agent answers.
- Writes the result to PayPal, all or nothing. Each cancelled amount is recorded on the real invoice. Redirected debt becomes a new PayPal invoice. If any call fails, every earlier one is reversed.
- Pays what is left. One PayPal payout per debtor; webhooks (or a poller) confirm each payment.
In the recorded run: $42,850 cancelled with no money moving, $7,200 held back, $14,200 paid through PayPal. Nobody's net position changed.
How we built it
Node.js and TypeScript, no framework. PayPal Invoicing v2, Payouts and Webhooks through plain REST calls, one sandbox app per business. Claude Opus 5.5 with structured outputs for every judgment call (Anthropic SDK or Claude Agent SDK). SQLite for state. React, AG Grid for the three ledgers, and a hand-drawn SVG debt graph.
Where the AI is, and where it is not
The clearing maths is deterministic code over integer cents. No model ever does arithmetic on money. Agents only answer yes, no, or yes-if. If an agent errors or refuses, the answer is no: the invoice is held or the business sits the round out. There is a test for this.
Challenges
PayPal has no transaction that spans several businesses, so a round is written as a set of reversible entries and undone together if one fails. Recording a payment on an invoice has no idempotency key, so each entry carries a marker in its note and OFFSET looks for the marker before writing. Sandbox test accounts can't re-spend received money for a while, which shaped the demo reset.
Accomplishments
A property test over 300 random debt graphs shows clearing never changes any business's net position, and the actions on invoices add up to the cent. Every PayPal failure path (write fails halfway, webhook delivered twice, payout rejected, model unavailable) is covered by a test.
What we learned
PayPal's Invoicing API already supports everything clearing needs: partial recorded payments, deletable payments, notes that come back on read.
What's next
Bridge loans placed where the smallest amount unlocks the most clearing (a fit for PayPal Working Capital), and acting for businesses through PayPal partner permissions instead of one app each.
Run it
npm install && npm run build && npm start, then open http://localhost:8787. With no keys it runs on a simulated PayPal with rule-based agents and says so on the page. See the README for the real sandbox and Claude agents.
OFFSET is a hackathon project, not a PayPal product.
Built With
- ag-grid
- claude
- node.js
- paypal-invoicing-api
- paypal-payouts-api
- paypal-webhooks
- react
- sqlite
- typescript
Log in or sign up for Devpost to join the conversation.