Inspiration

I build small games and web apps on my own, and I have made a web game together with one other person. When a few people make something together and sell it through one person's account, the split usually lives in a chat message and a spreadsheet. Only the account owner gets paid, so that person does the math and sends everyone's part by hand. The chat message also leaves things out: nobody decides whether a payback comes out before or after the payment fee, or where a capped share goes, until it matters.

What it does

Splitwright is for two to five people who sell one digital product through a single PayPal account.

  • The account owner pastes the deal as the team wrote it. Gemini converts it into ordered rules (pay someone back first, then percentage shares, with optional caps) and shows which sentence each rule came from.
  • Gemini also lists what the deal does not say, as questions with fixed choices. The owner answers them. The model is not allowed to guess. Rules can also be entered by hand.
  • A deterministic engine runs 160 sample sales so the team can see the edge cases before any money moves: the sale where a payback finishes, and the sale where a cap is reached.
  • Each member signs that exact version of the rules through a private link. Any edit creates a new version and needs new signatures.
  • When a buyer pays, the app captures the PayPal order, reads PayPal's fee from the capture, computes each share in integer cents, runs safety checks, and sends one PayPal Payouts batch. The owner's own share stays in the account.
  • Webhooks (signature verified on the server) update each payout line: Paid, Unclaimed, Failed. The owner has a ledger that shows the math behind every line, and each member has a "my share" page.
  • If any check fails (shares do not add up to the net amount, a per-item or daily limit would be exceeded, a recipient email differs from the signed rules), nothing is sent. The sale is held with the reason, and the owner can check again and pay later.

In the sandbox run shown in the video, a $12.00 sale had a PayPal fee of $0.77. The $11.23 that reached the account was split into Jun $8.97 ($8.00 payback plus $0.97), Mina $1.61 (kept in the account) and Sol $0.65. Jun's payout shows as Paid and appears in his sandbox PayPal account. Sol's email has no PayPal account on purpose, so her line shows as Unclaimed.

How we built it

  • Next.js and TypeScript on Vercel, Upstash Redis for storage.
  • PayPal REST APIs in the sandbox: Orders v2 (create, capture), Payments (show capture), Payouts (create batch, show batch), and Webhooks with server-side signature verification. Checkout uses the PayPal JS SDK buttons, plus a same-tab redirect for browsers that block pop-ups.
  • Gemini with structured JSON output for three jobs: deal to rules, finding open questions, and a plain-language summary of the final rules. Anything that fails validation stays "not decided" for the owner.
  • The split engine is ordinary TypeScript with unit tests. It is the only thing that produces amounts.
  • AG Grid Community for the ledger and the sample-sales table: sorting, filters, quick search, a pinned column and CSV export.
  • The plan was written with Claude Fable 5.2, and the code was written by a Claude Opus 5.5 coding agent following my instructions. The whole flow was tested end to end in the PayPal sandbox.

Challenges we ran into

  • Rounding. Splitting $11.23 three ways has to add back up to exactly $11.23 on every sale, including the sale where a payback finishes or a cap is reached halfway.
  • Keeping the model away from money. It only produces rules and questions, and the questions are limited to a fixed set of fields.
  • Payout status arrives later than the capture, so the ledger has to handle pending, unclaimed and failed items, and webhooks that arrive late or twice.
  • PayPal checkout pop-ups were blocked in some browsers, so I added a same-tab checkout that returns to the product page and captures there.

Accomplishments that we're proud of

  • One sandbox purchase goes all the way through: order, capture, fee read from the capture, split, payout batch, webhook, statement, and the money showing up in a member's sandbox PayPal account.
  • The question step. In the example deal it surfaces two decisions the original message never made.
  • Every amount on the screen can be traced to a rule version that every member signed.

What we learned

  • The capture response already contains the fee breakdown needed to split net revenue.
  • A language model is more useful for finding what an agreement leaves out than for doing anything with the money.
  • Payouts and webhooks are asynchronous, and the product has to show that honestly, including "Unclaimed".

What's next for Splitwright

  • Refunds: carry each member's part of a refund as a balance against future shares.
  • Let each team connect its own PayPal account, and move to PayPal's multiparty payments, which needs partner approval.
  • Batch small payouts daily or weekly to reduce fees.
  • Other currencies.

Try it (sandbox, fake money)

Demo: https://splitwright.vercel.app (press "Open a demo team"). Sandbox buyer: [email protected] / SplitDemo#2026. Step-by-step instructions are in the README: https://github.com/kyunghoonkook/splitwright

Built With

Share this project:

Updates

Submission history