-
-
The AI goal agent drafts the whole goal from one sentence
-
The friend accepts the pact with their PayPal email
-
PayPal places a hold with one tap. Nothing is charged yet
-
PayPal Payouts sends the missed stake to the friend
-
Every PayPal API call for a goal, listed in the app
-
The AI case agent advises the reviewer, using read-only PayPal lookups
-
The same calls in PayPal’s own sandbox API log
-
Gemini checks each proof rule. Goal met, hold released
-
A missed goal: a second AI model must agree before any charge
Inspiration
When I set myself a deadline, nobody checks, so I keep missing it. A to-do list costs nothing to ignore. Students, freelancers and solo builders all have this problem: the only person holding them to account is themselves. I wanted ignoring a deadline to cost something, without the app ever being able to take the money for itself.
What it does
ProofStake lets you put real money on your own deadline.
- Say the goal in one sentence. "Finish 10 calculus questions by 9 tonight, $20, Priya gets it if I don't." An AI goal agent fills in the whole form and makes the goal provable with one photo. The amount is always the user's choice.
- Agree the proof rules. The AI writes a short, strict list of what the photo must show. You read and accept them.
- PayPal holds the stake. An authorization, not a charge, placed with one tap on a saved PayPal account.
- Optional pact. A friend gets a link, accepts with their PayPal email, and receives a missed stake. They never judge the proof, so it stays fair. With no partner, a missed stake goes to a charity pool. ProofStake never keeps it.
- Prove it. Before the deadline you upload a photo of the finished work with a one-time code from the app handwritten on the page, so an old photo can't be reused.
- AI checks, code decides. Gemini checks the photo against each rule. Before any verdict can cost money, a second, different model reads the photo again and must agree.
- PayPal settles. Goal met: the hold is voided. Partly met: a proportional part is captured. Missed: the full stake is captured, and after a 5-minute appeal window PayPal Payouts sends it to the partner.
- A person has the last word. Unsure verdicts and appeals go to a human reviewer. An AI case agent gathers the facts, including read-only PayPal lookups, but it can't move money. An upheld appeal is refunded.
- Nothing is hidden. Every PayPal call for a goal (the hold, capture, refund and payout) is listed in the app and matches PayPal's own API log.
How I built it
- Next.js 16, React 19 and TypeScript, with Zod validation and SQLite, deployed on Railway.
- PayPal: Orders v2 with the JS SDK (intent AUTHORIZE), Payments v2 (void, capture, refund), Vault payment tokens, Payouts, Webhooks with signature verification, and the PayPal Agent Toolkit, limited to read-only tools.
- AI: Google Gemini (gemini-3.6-flash, with gemini-3.5-flash as the second opinion) for the rule writer, the vision check, the goal agent and the case agent. The agents run a tool loop: the goal agent checks the time, the user's history and the app's own rules before it drafts.
- The AI is kept away from the money. It never calls PayPal's money-moving APIs and never names an amount. A pure function maps a verdict to a money action, and only that code calls PayPal.
- Ports-and-adapters architecture. The core never imports PayPal, AI or database code, and modules talk through domain events. 256 automated tests cover it.
- Live updates without refreshing, through lightweight polling that slows down when nothing is happening.
Challenges I ran into
- Webhook verification only works if the raw request body is sent back to PayPal byte for byte.
- PayPal's authorization honor period is three days, so goals are capped at three days to avoid re-authorizing.
- Stopping an old photo from passing: the handwritten one-time code is matched by code, not by the AI.
- A redirect behind the hosting proxy pointed at an internal address and blanked the page after upload. A relative redirect fixed it.
- Calling a second model costs time, so it only runs when a verdict would charge money or a pass is borderline.
Accomplishments that I'm proud of
- Every PayPal money action in one product: authorize, void, partial capture, full capture, refund and payout, all driven by verified rules.
- An AI that is genuinely useful (drafting, checking, investigating) but structurally unable to move money.
- A full appeal path with a real person and an AI helper, so a wrong verdict can always be fixed.
What I learned
PayPal's authorize-then-decide model is a natural fit for commitment contracts: the money is committed but not spent. I also learned that an AI system becomes trustworthy when its limits are enforced in code, not in the prompt.
What's next for ProofStake
- More proof types, such as links, commits and fitness-app screenshots.
- Longer goals, with re-authorization.
- A real charity partner for the charity pool.
- Recurring goals and group pacts.