Inspiration

Picture a creator platform that pays 420 writers a month out of a Google Sheet that three people edit, and paid two of them twice last quarter; one of those duplicates cost more than a month of software. Or a finance lead paying 950 people a month who puts it plainly: "a single Approve button is not maker-checker." (Both are simulated buyer personas from a discovery exercise, not customers.) Both still pay from a sheet because the sheet is where the decision happens. So Disburse keeps the sheet and gives it a gate: import last cycle's rows, let the grid hold what should not go out, click Approve, and send one idempotent batch.

Backtest: import last cycle's sheet

Every pilot starts with the backtest: import last cycle's sheet; the duplicates come out flagged before a dollar moves. "Import CSV" takes any payee sheet (lenient headers: recipient_email, Email, Amount (USD), currency, note, reference, any order) and runs it through the same hold rules as a planned batch. demo/last-cycle.csv has twelve October rows; importing it holds the duplicate (same email, two spellings), the $4,200 outlier (19× the batch median); every import also checks PayPal's Disputes API and would hold anyone with an open dispute (the sandbox merchant has none open today). The batch stays a draft.

What it does

Rows come from a CSV (tagged csv) or from an instruction: "Pay October creator commissions at 12%, hold anyone with an open dispute, nothing over $500." With the planner on, Claude parses that into typed parameters (rows tagged model); with the header toggle set to Off, a rule parser reads the rate, cap, month and hold instead (rows tagged rule), so the product works with no model in the loop. A deterministic planner computes every row with its arithmetic as the reason, then holds what must not go out: over the cap, duplicate recipient, below the minimum, more than 4× the batch median, or a recipient with an open PayPal dispute, checked live through the Disputes API. You can edit amounts and notes in the grid, hold or override rows, then approve. One Payouts batch goes to PayPal, keyed by the batch id so a retry can never pay twice. Statuses poll back into the rows; an UNCLAIMED item gets a cancel-and-reissue button.

How I built it

Go, Preact with AG Grid Community (cell editing, undo/redo, pinned totals, row class rules), Postgres, the shared paypalgo library. The APIMatic PayPal Context Plugin was installed into Claude Code for the build. Its skills document the generated PayPal Server SDK: orders, payments, vault, transaction search, subscriptions. Payouts and Disputes are absent from it, which is exactly the gap Disburse fills. So the gap was closed with APIMatic's own pipeline: apimatic api:validate found four errors in PayPal's published Payouts spec, sdk:generate produced a Go SDK from the fixed copy, and that generated SDK is what moves the money in the app (internal/payouts/gateway.go). docs/apimatic.md records what the plugin gave, what validation found, and the live sandbox batch sent through the generated client.

Challenges

My first sandbox business account was Indian, and PayPal returns PAYOUT_NOT_AVAILABLE for it, so the send stayed unproven until I moved the app to a US business sandbox account. On that account a real batch goes PENDING, PROCESSING, SUCCESS in about thirty seconds and the rows update from signed webhooks. That first live run also caught a bug: the reissue endpoint accepted a payout the first recipient could still claim, which could pay twice. It now requires the money to be back. One thing still fails on PayPal's side: cancelling an unclaimed item returns an internal server error in the sandbox.

Accomplishments

Twelve rows planned from one sentence with no hallucinated numbers; a twelve-row CSV backtest that holds a duplicate and a 19× outlier, with a live Disputes API check, before any money moved; an editable grid that is honest about what it will and won't send, with or without the model.

What I learned

An LLM is a fine parser and a terrible accountant. Let it read the instruction; let code do the arithmetic and the holds.

What's next

Contributing the Payouts SDK back as a context plugin so the next agent has it, webhook-driven status updates on the hosted version, and a Channel3 creator-commission source so rows come from real affiliate transactions

Built With

  • ag-grid
  • apimatic
  • claude
  • docker
  • go
  • paypal-disputes-v1
  • paypal-payouts-v1
  • paypal-webhooks
  • postgresql
  • preact
  • render
Share this project:

Updates

Submission history