Inspiration
Every group gift I've been part of ended the same way. Someone in the group chat asks "who's getting the gift?", one person says "I'll order it, send me your part"... and then spends the next three weeks chasing everyone for $16.
The hard part of a group gift is not finding the gift. It's the money. One person carries all the risk: they pay upfront, they chase, and if someone drops out, they're stuck with it. I wanted to see if an AI agent plus PayPal could take that job away completely, so that nobody has to be the bank.
What it does
Gifted turns a group gift into one sentence and one link:
- Find: You describe the occasion in plain language: "We're 5 friends getting something for Lena's 30th. She loves climbing and coffee. About $25 each." Claude turns that into a brief (who, interests, group size, budget per head), searches real stores through Channel3, and picks three gifts with the price per person, shipping included.
- Invite: You pick one, Gifted creates the group, and Claude writes the invite for your group chat. You share one link.
- Everyone reserves: Each friend opens the link and reserves their share with PayPal. The money is authorized, not charged. The share ring fills live on everyone's screen.
- The agent closes: When the last friend is in, the agent re-checks price and stock and only then captures every share at once.
- If it doesn't work out: If someone drops out, time runs out, the price goes up or the gift sells out, the agent voids every reservation. Nobody pays.
How I built it
- Next.js 16 (App Router, TypeScript, Tailwind CSS 4), deployed on Render
- Claude API with structured outputs for three jobs: understanding the request, picking and explaining the gifts, writing the invite
- Channel3 for product search and fresh price and stock checks right before anyone pays
- PayPal Orders API v2 + Payments API in the Sandbox:
intent: AUTHORIZEfor reserving, then capture, void and refund - Upstash Redis for group state and per-IP rate limits
The core of the project is a small state machine around money. Shares have to add up to the exact cent. For a total of $T$ cents and $n$ people:
$$ s_i = \left\lfloor \frac{T}{n} \right\rfloor + \begin{cases} 1 & i \le T \bmod n \ 0 & \text{otherwise} \end{cases} \qquad\Rightarrow\qquad \sum_{i=1}^{n} s_i = T $$
So a \$53.94 gift for 5 people becomes four shares of \$10.79 and one of \$10.78, never a cent more or less.
The closing rule is deliberately strict. The agent only captures if the gift is still in stock and the new price $P_{\text{new}}$ is not higher than what was reserved:
$$ \text{capture} \iff \text{in stock} \;\land\; P_{\text{new}} \le P_{\text{reserved}} $$
If the price dropped, everyone pays their share of the lower price. If it went up, everything is released. If a single capture fails, shares already collected are refunded in full, so a group never ends half paid. These rules are covered by automated tests.
Challenges I ran into
- The obvious PayPal tool was blocked. My first plan was to send each friend a PayPal payment request through the Invoicing API, but it returned 403 for my app. That forced a better design: authorize now, capture later. A reservation is a much better fit for "nobody pays unless everyone is in" than an invoice anyone can ignore.
- Authorizations expire. PayPal honors an authorization for a limited time, so every group has a 3-day window. When it runs out, the agent releases everything instead of leaving money in limbo.
- Partial failure. "Capture five payments" can fail at payment number three. Designing the refund and void path so the group always ends in a clean state took longer than the happy path.
- Free hosting has no memory. Render's free tier loses files on restart, and its free Postgres expires, so group state moved to Upstash Redis.
- Judges can't log in with five PayPal accounts. I added a clearly labeled Sandbox demo mode where simulated friends fill the open spots, while your own share stays a real PayPal Sandbox payment. For anyone who wants the full experience, there are also five test buyer accounts.
What I learned
- The best place for an agent is where people feel friction, not where they need ideas. Gift ideas are easy. Collecting money from five friends is the real pain.
- An agent that handles money needs hard rules around it. Claude does the understanding and the writing. Every decision about money is plain, tested code with a clear rule: check again, then charge, or release everything.
- Payment primitives shape the product. Learning the difference between authorize, capture, void and refund changed the whole flow for the better.
What's next
Right now Gifted collects the money as merchant of record. The next step is placing the actual order with the shop once the group is complete, plus reminders for friends who haven't reserved yet.
Built With
- anthropic
- channel3
- claude
- elevenlaps
- next.js
- node.js
- paypal
- paypal-orders-api
- react
- redis
- remotion
- render
- tailwindcss
- typescript
- upstash