Inspiration

Splitting group expenses is easy when everyone shares every cost equally. Real trips are messier. One friend skips the wine, another pays for the ride, and someone has to reconcile the receipts, referee the disagreements and chase the payments. Even after everyone agrees on what they owe, settling up is another manual step.

Personal AI agents are arriving fast, and PayPal already lets agents pay merchants. We wanted to know: what happens when your agent can settle up with your friends' agents?

What it does

Square gives each friend an AI agent that follows their own rules for shared expenses: "I don't drink", "ask me before paying over $150", "shared bookings stay shared".

  • Track: tell your agent what you paid, by chat or receipt photo. Expenses live in groups: a trip, roommates, a lunch crew.
  • Combine: when two people settle, one payment covers every group they share. Alex owes Sam $60 for surfing and Sam owes Alex $23 for lunches, so their agents settle once: $$60 - 23 = 37$$
  • Negotiate: the two agents prove who they work for with signed credentials, exchange an itemized statement, dispute lines that don't look right, and rule on each dispute by their own person's rules.
  • Decide in code: Square computes every amount; the model never does the math. A separate check makes sure each agent's explanation matches its decision before any money moves.
  • Pay: over the payer's limit, they approve it first. PayPal pays the friend directly (the friend is the payee on the order), so Square never holds the money.
  • Verify: the receiving agent checks the order on PayPal itself, through the PayPal Agent Toolkit, and every settle-up ends with a signed receipt.

How we built it

  • Next.js + TypeScript, hosted on Render.
  • OpenAI (gpt-4.1-mini) powers the agents: reading expenses and receipt photos, reviewing statements, ruling on disputes, and a tool-use loop over PayPal Agent Toolkit tools (get_order, create_invoice, send_invoice) for verification.
  • PayPal Orders v2 pays the friend directly; Vault v3 supports an optional standing allowance; Invoicing is an alternative for friends who prefer an invoice; webhooks feed the activity log.
  • Agent messages, credentials and receipts are HMAC-signed.
  • Settlement is a saved state machine with idempotent PayPal-Request-Ids, so a retry can never charge twice.

Challenges we ran into

  • Keeping AI away from the money logic. The model decides what's fair; code decides the amount and whether it can be paid.
  • When an agent's words and its decision disagree. A model can say "fair, I've taken it off" while its structured answer keeps the line. Square re-checks every explanation against the decision, retries once, and otherwise rewrites the explanation and asks the human before paying.
  • Paying friends directly. PayPal's sandbox wouldn't charge a saved allowance with a friend as the payee, so Square falls back to a one-time PayPal approval: still person to person, still never holding the money.
  • Honest payments under failure. A settle-up is only marked settled once PayPal confirms the payment and the receiving agent verifies it independently.

Accomplishments that we're proud of

The receiving agent doesn't trust the paying agent: it checks PayPal itself. Every settle-up leaves an auditable trail of signed messages, so you can see exactly how the agents reached the number.

What we learned

Agent-to-agent payments need the same things people need: identity, receipts, rules, and a way to say "that's not right." Putting those in code, not in the prompt, is what makes it safe to let agents talk about money.

What's next for Square

Roommate rent and recurring subscriptions, settling across more payment rails, and letting people's existing personal assistants speak Square's protocol, so any agent can settle up with any other.

Built With

  • gpt-4.1-mini
  • hmac
  • next.js
  • node.js
  • openai
  • paypal
  • paypal-agent-toolkit
  • paypal-orders-api
  • paypal-rest-api
  • paypal-vault
  • paypal-webhooks
  • playwright
  • react
  • render
  • typescript
Share this project:

Updates

Submission history