The problem
Every new cafe, gym or bakery starts as a bet. The owner can't know who will come, and the neighbors who would come can't say so in a way that counts: a "like" costs nothing, and paying a stranger for a place that may never open is a risk few will take.
What Threshold does
An owner opens a campaign: a pledge amount, a goal of neighbors and a deadline. Neighbors pledge with PayPal, which only holds the money: a pledge is an authorization, not a charge. If enough neighbors join by the deadline, every hold is captured and the owner is paid out. If not, every hold is released, so nobody pays for a place that never opens.
Threshold goes further than a pledge page in three ways:
- An assistant that cannot spend your money. On the Ask page you first set limits: the most for one pledge and in all, how many, for how long, which kinds of place, how far. They become a signed token. The assistant finds campaigns and prepares a pledge, but the server checks every pledge against your limits and only you can approve it, in PayPal. The model never sees a receipt, an approval link or the numbers in your limits, and it has no tool that changes them. Whether a message means "back this one" is decided by fixed rules in code before any model is asked (a question, a hesitation or a condition is not consent), and every sentence about a pledge is written by the server, not the model.
- Check, don't trust. Every pledge is signed (Ed25519) with the exact terms it was made under: the amount, the goal, the deadline and who is paid. PayPal's order carries the terms' fingerprint in its
invoice_id. A campaign's proof page re-checks every signature, confirms the terms did not change, asks PayPal whether its own record agrees (state, amount, invoice) and says plainly when something differs. It names no one. - Bring your own agent. An MCP server lets Claude, Copilot or any MCP client find campaigns, read one, check its proof and prepare a pledge inside the same limits. It never sees a card or an account.
Check a spot helps an owner before they start: enter an address and a kind of business and see what OpenStreetMap lists within a 10-minute walk, on a real street map. It shows supply, never demand, and says so when the map data is incomplete or unavailable instead of guessing.
How PayPal is used (it is the core of the product)
- Orders v2, intent
AUTHORIZE: a pledge is an order that PayPal only authorizes, a hold and not a charge.custom_idis our pledge id andinvoice_idcarries the terms' fingerprint. - Payments v2, capture / reauthorize / void: at the deadline a funded campaign captures every hold (reauthorizing first when past PayPal's honor period); a missed or cancelled one voids them all. Idempotent and resumable.
- Payouts: the net collected, after PayPal's fees, is paid to the owner's PayPal email, once per campaign.
- Webhooks: verified with PayPal's verify-webhook-signature API on the raw body; they keep pledges and the payout in step.
- JavaScript SDK v6: the PayPal buttons on a campaign's page, in PayPal's own window.
How AI is used
- Google Gemini (with Groq as a fallback) drafts a campaign's words for its owner to edit and phrases the assistant's answers. Rules in code check what it writes, and it never sets a number, a link or a payment. With no model available, the same facts appear in fixed words.
- Any other agent can work through the MCP server, inside the same signed limits.
- GitHub Copilot's agent mode wrote much of the code under my direction; it is tested by the suites below.
- The demo video's narration is an AI voice (Google Gemini TTS).
A real run in PayPal's sandbox
Three sandbox buyers pledged $5 each. $15.00 was collected, PayPal's fees were $1.98 and $13.02 was paid out to the owner. The proof page verified every pledge against PayPal, and PayPal's own payout record matches. A second campaign was cancelled and its hold voided. See the proof.
Built to be used
Terms are in plain words ("PayPal holds $25. You are charged only if 40 neighbors join by Nov 30; otherwise the hold is released."), the site works on a phone and respects reduced motion, backing a campaign never needs an account, and a privacy page says what is kept. The backend has 965 automated tests and the frontend 382, and scripts/e2e.py runs the whole flow against PayPal's sandbox. The API runs on Render (a Docker web service with a health check; its Blueprint, render.yaml, is in the repo), the database is Neon Postgres and the front door is Cloudflare Pages. Sponsor tool used: Render.
What is new, and what it started from
Threshold began in November 2026 (first commit 2 Nov), inside the submission period, from the payments engine and app shell of Walk-in Founders (github.com/AhmedOsamaAli/walk-in-paypal, MIT, my earlier project; the first commit says so): campaigns, pledges as PayPal authorizations, settlement, payouts, webhooks, private receipts and the Cloudflare front door. The signed terms and the proof, the limits and the Ask assistant, Check a spot, the MCP server's proof and limits, and the pages that carry them were written for Threshold.
Honest limits
- Sandbox only. The owner is paid straight to a PayPal email; a real marketplace would use PayPal's seller onboarding, platform fees and a refund policy.
- Not an escrow or a guarantee. A pledge is a PayPal authorization, which lasts 29 days, so campaigns run at most 27. Nothing verifies that the place will open.
- OpenStreetMap is volunteers' work and can be incomplete; Check a spot says so with every answer.
- The campaigns on the live demo are fictional. Free hosting sleeps: the first request after a quiet spell can take about a minute, and the page says so.
What's next
PayPal seller onboarding and platform fees for real payouts, a refund and dispute policy, and more kinds of agents through the MCP server.
Credits
Map data (c) OpenStreetMap contributors (ODbL); street map tiles by OpenFreeMap; ten-minute walking areas by Valhalla (FOSSGIS). The film's 3D buildings are drawn from OpenStreetMap, with illustrative heights where the map has none.
Built With
- cloudflare-pages
- fastapi
- github
- google-gemini
- groq
- maplibre
- model-context-protocol
- neon
- openstreetmap
- paypal
- paypal-javascript-sdk
- paypal-orders-api
- paypal-payments-api
- paypal-payouts
- paypal-webhooks
- postgresql
- python
- react
- render
- typescript
- valhalla
- vite