Inspiration

Families abroad send billions home every year, and a large share of it is meant for something specific: a term's school fees, a hospital bill. But a transfer only carries an amount. The moment the money lands, the reason it was sent disappears. The sender can only hope it was spent as intended, and the person receiving it is left under pressure from every other urgent need.

We wanted money that remembers why it was sent.

What it does

Earmark keeps the purpose attached to the money.

  1. Write the purpose in one sentence. For example: "$200 for my daughter's Term 1 fees at [School]."
  2. AI turns it into a readable contract: who gets paid, for what, the maximum amount and the deadline. The sender reviews and approves it.
  3. PayPal holds the money instead of sending it. The funds are authorized, not captured.
  4. The school uploads its invoice. AI extracts the fields, and then 17 fixed, deterministic rules check the invoice against the contract.
  5. Only if every rule passes is the exact invoice amount paid to the school's registered account. The rest goes back to the sender:

$$\text{refund} = \text{amount held} - \text{invoice amount}$$

  1. Every step is written to a receipt anyone can verify.

The key design choice is this: AI reads, but it never decides and never moves money. A tampered or mismatched invoice is blocked by the rules, not by a model's judgement.

How we built it

  • PayPal (sandbox): Orders v2 with intent: AUTHORIZE to hold the funds, capture when the rules pass, void when they fail, and [Payouts] to the school's registered account. The UI shows PayPal's own order, capture and payout IDs, so every number can be traced back to PayPal.
  • AI: [model/provider] parses the purpose sentence into a structured contract and extracts fields from invoices.
  • Rules engine: 17 deterministic checks in [language], covering [e.g. payee identity, amount ceiling, purpose match, dates, signs of tampering].
  • Receipts: [how verification works, e.g. hashed, append-only log of each step].
  • Stack: [frontend], [backend], [database/hosting].
  • We built much of it by pairing with a Claude Code agent, and we scripted our demo video with Playwright.

Challenges we ran into

  • Making the money real. Our first version updated balances in our own UI, but nothing moved in PayPal. We rebuilt the flow so PayPal is the source of truth: the UI only shows state that PayPal returns, and you can match every transaction ID on sandbox.paypal.com.
  • Keeping AI out of the decision path. It was tempting to let the model say "this invoice looks fine." We forced every decision through fixed rules instead, so the outcome is explainable and can be repeated.

Accomplishments that we're proud of

  • An end-to-end flow where real sandbox money is held, checked and released, with no number on screen that PayPal didn't return.
  • A clear split of responsibilities: AI reads, rules decide, PayPal moves money.
  • A tampered invoice is caught and the money stays protected.

What we learned

  • Authorize-then-capture is a natural fit for conditional money, because holding funds is a first-class feature of the payments API.
  • In financial products, the most trustworthy AI is the one with the narrowest job.
  • Judges and users both need proof, not a dashboard. Showing PayPal's own IDs builds more trust than any chart.

What's next for Earmark

  • Hospital bills and other purposes beyond school fees.
  • Letting schools and clinics register directly, so payee accounts are verified once and reused.
  • Partial and instalment releases, such as fees paid term by term from one earmark.
  • Testing with Kenyan families sending money home from abroad.

Built With

  • ag-grid
  • anthropic-claude
  • drizzle-orm
  • google-gemini
  • javascript
  • next.js
  • node.js
  • paypal-agent-toolkit
  • paypal-js-sdk
  • paypal-mcp
  • paypal-rest-api
  • playwright
  • pnpm
  • react
  • shadcn-ui
  • sqlite
  • tailwindcss
  • typescript
  • vercel-ai-sdk
  • vitest
  • zod
Share this project:

Updates

Submission history