-
-
CloseDesk: check PayPal against what the shop promised, then fix every gap.
-
The bookkeeper desk in AG Studio: exception queue, Books vs PayPal bridge and Close Meter at $306.17 unexplained.
-
One approval card: quoted support promise, amount, and the bridge change before the owner approves.
-
The owner's one-time link page where the money move is approved.
-
Signed close package: PayPal ids executed, books vs PayPal, approvals.
Inspiration
Sync tools copy PayPal into the books. Checking PayPal against what the shop promised customers (a refund support said was done, a coupon, a held payment) is still manual. PayPal says the same about its own sync: "Accounting Sync replaces manual data entry, not your accountant's judgement." In a survey of accounting firms, the team member handling ecommerce clients spends an average of 38 hours per month on manual labor (Woodard Report, 2022). CloseDesk is for the outside bookkeeper who has to explain every dollar PayPal and the books disagree on before the owner signs the month.
What it does
Sync tools check PayPal against your books. CloseDesk checks PayPal against your promises.
A daily check reads the seller's books, the support replies and PayPal, and finds seven kinds of gap. Each becomes one approval card with quoted evidence and the exact change to the bridge:
- E1 Promised refund never sent: full refund (owner approves)
- E2 Paid twice: refund the duplicate (owner)
- E3 Coupon not applied: partial refund (owner)
- E4 Shipped, hold never captured: capture (owner)
- E5 Cancelled, hold still open: void (owner)
- E6 Shipped, never billed: create and send an invoice, carried forward (bookkeeper)
- E7 Paid by bank, invoice still open: record the payment on the invoice (bookkeeper)
Rules that never bend: money is integer cents computed by server code, and the model never supplies an amount. A promise is a quoted sentence, and a quote that is not literally in the message is dropped. Only the owner can move money, from a signed one-time link (30 minutes) opened in a separate tab. Every action runs under a per-order lock with a PayPal-Request-Id, so two clicks make one refund. Sign close opens only at $0.00 unexplained.
The demo shop, Brightloom Candles, is made up. In the demo period 15/20 orders match, 7 exceptions are found and Unexplained starts at $306.17. The hosted demo runs live Claude Sonnet with per-IP-hour and per-day caps (a labelled recorded run or rule-based stand-in is used if the API fails or a cap is hit). PayPal on the hosted demo is an offline stand-in that follows the real sandbox responses; the real sandbox ids are listed in the Sandbox evidence tab.
How we built it
AG Studio (AG Grid) is the central screen. The whole desk is one AgStudio component with four custom widgets (Exception Queue, Books vs PayPal Bridge, Close Meter, Owner Approvals), a ledger-paper theme in light and dark, three layouts (bookkeeper, merchant, client board), a data engine over five tables with cross filtering, and a custom Close Agent built on the Studio Agent Framework. The Close Agent has its own tools and delegates to Studio's built-in Page and Widget agents, for example to build a pie chart of money by direction. Studio 3.1.0 has no Claude adapter, so we wrote one: the browser posts a provider-neutral turn to our server, which translates it to the Anthropic Messages API and back, so the key never reaches the browser.
PayPal Orders, Payments and Transaction Search calls go through the APIMatic-generated PayPal TypeScript SDK (followed the APIMatic Context Plugin skills). Invoicing stays on REST because the SDK has no such resource. The PayPal Agent Toolkit gives Claude read tools (get_order, list_transactions, get_invoice, search_invoicing). Claude Sonnet reads support replies to find promises and answers "why is this an exception?". Stack: React 19, Vite, Express, zod.
PayPal sandbox and AI: the PayPal sandbox was used for orders, captures, refunds, voids, invoices and Transaction Search. Claude finds promises and explains gaps; all money moves are PayPal API calls approved by a human.
Challenges we ran into
Transaction Search answered 403 until the scope was granted. Once granted, newly seeded payments took about 5 hours to be indexed, longer than PayPal's documented three, so the first sandbox close ran in a fallback mode (order lookups) that says so on screen and skips the duplicate check; the same period later ran with Transaction Search. The sandbox answers an invoice create with the whole invoice rather than a link, and authorize/capture order calls answered 415 without a body; both fixed. Card orders answered 422 PAYEE_NOT_ENABLED_FOR_CARD_PROCESSING, so seeding uses PayPal-account orders approved by a sandbox buyer. Reauthorize on day 0 answered REAUTHORIZATION_TOO_SOON, as PayPal documents. Delegating a "new pie chart" to Studio's Widget agent alone turned an existing grid into a pie; a new widget needs the Page agent first, so the Close Agent now delegates twice.
Accomplishments that we're proud of
- A full close of a seeded sandbox period, end to end in the app: refund 0TB68373FK703634V, partial refund 2T248348FD9414800, capture 5P5249954H751362W, void of hold 1U584327LU028570K, invoice INV2-KVD5-PJMK-3TMB-GNLV sent, payment EXTR-72W43837WD604723W recorded. Signed at $0.00 with $58.00 carried forward, every status read back from PayPal.
- Once the sandbox index caught up, the same period ran with Transaction Search: the duplicate check found order 1051 paid twice and the owner link refunded it (refund 6VY43897TU6121035). The same link used again answered "already used".
- Claude Sonnet runs the promise reading, "Ask the Close Agent why" and the AG Studio starter prompts, including two-step delegation to Studio's built-in agents.
- Money safety by construction: the model never supplies amounts, quotes are verified against the message text, only the owner moves money, actions are idempotent, and disputes block actions.
What we learned
Sandbox timing and scopes decide what a reconciliation tool can promise, so the app labels which data source it is using. Keeping the model away from amounts and making every claim a verifiable quote made the AI part safe to put next to money. A "lost answer" from PayPal is reported as "outcome unknown" and settled by re-reading, never as failure.
What's next for CloseDesk
Partner (third-party permission) onboarding so each seller grants access and PayPal itself limits the bookkeeper's role. Then real connectors for the books (QuickBooks, Xero) and the support inbox; the demo seeds both. Sandbox mode needs the seller's own sandbox credentials.
Built With
- accounting
- ag-grid
- ag-studio
- agents
- ai
- anthropic
- apimatic
- bookkeeping
- claude
- express.js
- fintech
- invoicing
- node.js
- payments
- paypal
- react
- reconciliation
- refunds
- typescript
- zod