Inspiration
When floods hit Nepal, Mozambique or Cox's Bazar, thousands of people want to help at once, often with $5 or $10 each. But in a lot of giving, the biggest cheque decides where help goes: matching programmes double whatever you give, and crowdfunding lists rank campaigns by totals, so one $1,000 donor can outweigh a hundred neighbours giving $10. We wanted the crowd to decide instead, and money to reach projects only when they show proof.
What it does
Community Giving is crowdfunding with quadratic matching, AI agents and PayPal end to end.
- Quadratic matching. A sponsor-funded pool is shared by how many people back a project. A hundred neighbours giving $10 beat one $1,000 cheque, and donors see what their gift unlocks before they pay.
- A Giving Agent. Donors set rules in plain words ("$20 a month, water and health, ask me above $10"). The AI drafts them, the donor approves, and the agent gives within them, explaining every choice on a public trace.
- Proof before payout. Funds sit in milestones. Projects upload receipts, the Milestone Agent checks them, and PayPal Payouts releases the money. Large amounts wait for an admin.
- Managed purchases. The Procurement Agent picks a supplier on price and reliability, and PayPal pays them directly, with a public receipt.
- A Watchdog for fake crowds, not real communities. A church or a village rallying behind its own project is exactly what we want. The Watchdog flags fake "many people" instead: bursts of brand-new accounts, collusion rings, owners funding themselves. It freezes only that project's matching, never the donations, and a person decides.
- Trust tools. A tamper-evident audit log, a kill switch for every money-moving agent, reconciliation and refunds.
How we built it
- Core API: Python, FastAPI and Postgres. The only service with PayPal keys: orders, ledger, matching engine, payouts, refunds and reconciliation.
- PayPal: Checkout, Subscriptions, Payouts, Refunds and verified webhooks, each booked exactly once. All in sandbox.
- AI agents: DeepSeek V4 Flash reads and writes text (drafting rules, filtering searches, reports, reading receipts). Rules in code decide every gift, price and payout, and the API re-checks them. The agents reach the API only through our MCP server.
- Website: Next.js, with AG Grid for the leaderboard and admin grids, and a Bryntum Gantt milestone timeline.
- APIMatic for the developer portal and SDKs, and Render hosting everything from one Blueprint.
Each project's score grows with the square root of every gift, so many small backers count for more than one large one:
$$\text{score}p = \Big(\sum{i} \sqrt{c_i}\Big)^2 - \sum_{i} c_i$$
Challenges we ran into
- Never paying twice. PayPal can send webhooks twice or out of order, so every event, refund and payout batch is recorded once by id, and a milestone can be paid either as a tranche or as a purchase, never both.
- Keeping the AI in its lane. We moved every limit into code-checked contracts, so the AI proposes and the rules decide.
- Free hosting. Render's free plan sleeps and has no cron, so projections refresh on wake-up and the API upgrades its own database schema at startup.
- A spec the tools accept. We converted FastAPI's OpenAPI 3.1 to 3.0 with full docs, taking APIMatic's report from 1,490 issues to 0 errors.
Accomplishments that we're proud of
- Real sandbox money flowing end to end: checkout, subscriptions, payouts and refunds in one reconciled ledger.
- Agents that move money but can't overspend, behind API checks, a kill switch and a tamper-evident log.
- A Procurement Agent that chose a supplier and paid it through PayPal Payouts, with a public receipt and trace.
- A matching engine that reproduces our design's worked example to the cent, and over 200 automated tests.
What we learned
- Quadratic funding is easy to game, so the Watchdog matters as much as the formula.
- Money first, AI second: AI is great at reading and explaining, but gifts and payouts belong to rules people can check.
- How to build on PayPal for real: idempotent orders, verified webhooks, and Subscriptions and Payouts working together.
What's next for Community Giving
Real receipt uploads, donor logins, more supplier types for the Procurement Agent, and a first live round with a partner community.
Built With
- ag-grid
- agents
- apimatic
- apscheduler
- bryntum
- deepseek
- docker
- fastapi
- mcp
- next.js
- openai-sdk
- openapi
- paypal
- paypal-checkout
- paypal-payouts
- paypal-subscriptions
- postgresql
- pydantic
- pytest
- python
- react
- render
- sqlalchemy
- tailwindcss
- typescript