-
-
Monte: what each card earned, minus its fee and interest.
-
Where it went: a year of Jordan's spending by store and category.
-
The Receipt: rewards + perks − fees − interest. Jordan's three cards net −$427.03.
-
Leaks: $735 a year in interest on the Apple Card, with the fix.
-
Replay: the same purchases moved to the right card in his wallet. $104 back.
-
Tap: the best card at the register. Here the Amex Gold earns 4x at Sweetgreen.
-
Pay this first: which balance to pay down first, and how long the $2,800 takes to clear.
-
Every purchase: all 576, each showing the card used and the right one.
-
Keep or cancel: each annual fee against the value the card adds.
-
Next year ×1,000: as paid vs. on the right card, over 1,000 simulated years.
-
Trace a purchase: rule, arithmetic, issuer source and date for every dollar.
-
Wrapped: Jordan's year in eight cards.
-
Real vs. simulated: what is real on the page and what is demo data.
-
Monte vs. the rest: card pickers choose a card; Monte counts fees and interest too.
-
Apply: the next card, ranked on Jordan's spending, not referral fees.
PayPal checkout and a Claude checkout agent
Monte works out which credit card to use for a purchase, counting rewards, spending caps and interest. We connected that answer to PayPal: you tell Monte what you're buying, Claude explains which card to use and why, and you pay with PayPal. PayPal runs in its sandbox, so no real money moves.
Monte's first commit was Oct 17, 2026, and the PayPal checkout and checkout agent were added in November. The repo's commit history shows when each part was added.
One purchase, start to finish
- In the Tap view, type what you're buying, for example "I'm spending $84 on groceries at Trader Joe's."
- Claude reads it and calls
rank_cards, which runs Monte's engine on every card in the wallet. For Jordan, our sample person, the engine picks Amex Gold: +$3.36 on this $84.00, with $24,916.00 of the card's $25,000 yearly cap left afterwards. A card that carries a balance is never picked. - Claude explains the pick in a sentence or two and calls
create_paypal_order, which creates a PayPal order for the engine's amount. - You approve the payment in PayPal's window. Monte captures it, the receipt shows the reward, and the card's cap counter moves.
- "Return it" on the receipt refunds all or part of the payment through PayPal. Once the refund completes, Monte gives back the cap room and takes back the matching rewards.
Also added
- Pay in 4 vs. your card's interest. For purchases from $30 to $1,500, Monte puts PayPal Pay in 4 (four 0% payments, two weeks apart) next to what the same purchase would cost on a card that carries a balance. $64.20 of groceries at 26.24% APR, paid off over 12 months, costs about $9.49 in interest. PayPal decides who qualifies for Pay in 4, and late payments can carry fees.
- Import PayPal purchases. Transaction Search brings your PayPal purchase history into Monte, so that spending counts toward your caps and your year. Refunds, fees and transfers are left out. PayPal doesn't say which card paid, so you pick it.
- Recurring charges from your bank. With a Plaid sandbox bank linked, Leaks lists the bank's recurring charges and the card each one bills to.
- The agent handles returns. "Return the Trader Joe's purchase" gets a refund proposal, priced by the engine from PayPal's own record of the capture. Nothing is refunded until you press Confirm.
- Itemized orders. PayPal's review page lists what is being bought and which card Monte picked, and
GET /api/paypal/order/{id}reads back PayPal's record of the order, its captures and its refunds. - Webhooks.
/api/paypal/webhookverifies every event with PayPal before reading it, so a refund issued from the PayPal dashboard is still seen. - PayPal activity (
/paypal): each checkout, the card Monte played, what it earned, what came back, and imported PayPal history, with totals and a CSV download. - Venmo and Pay Later buttons, behind a flag until we have tested them in the sandbox.
PayPal APIs
- OAuth 2.0 client credentials (
POST /v1/oauth2/token) - Orders v2: create (
POST /v2/checkout/orders) and capture (POST /v2/checkout/orders/{id}/capture) - Payments v2 refunds (
POST /v2/payments/captures/{id}/refund), sent with aPayPal-Request-Idso a retried request can't refund twice - Orders v2 and Payments v2 reads (
GET /v2/checkout/orders/{id},GET /v2/payments/captures/{id}), so refunds and the order page trust PayPal's numbers, not the browser's - Webhooks (
POST /v1/notifications/verify-webhook-signature) - Transaction Search (
GET /v1/reporting/transactions) - JavaScript SDK v6: a one-time payment session with
<paypal-button>
The PayPal client only has the sandbox URL. Any PAYPAL_ENV other than sandbox counts as not configured. Every response carries nosniff, a strict referrer policy and frame-ancestors 'self', so another site can't frame the Pay or Confirm buttons, and /api/health says what is connected and which commit is live without showing a key.
AI
- Claude Opus 5.5 (Anthropic SDK) is the checkout agent. It turns a typed purchase into tool calls and explains the result.
- Claude Haiku 5.5 (Anthropic SDK) cleans up bank merchant strings and picks one of 20 categories: "SQ *BLUE BOTTLE COF 0417 LOS ANGELES CA" becomes Blue Bottle Coffee, dining.
- Claude Code was our coding assistant for the code, tests and docs. We reviewed and tested what it wrote.
Keeping Claude away from the money
The agent explains and proposes. It doesn't calculate and it doesn't pay.
- Claude never computes a dollar amount.
rank_cardsruns the deterministic engine. Claude only passes the store, category and amount, and the amount has to appear in what you typed. create_paypal_ordertakes no arguments, so the order can only be for the engine's amount.- Every number in Claude's reply has to appear in a tool result or in your message, and the reply has to name the engine's card. If it doesn't, Monte shows a sentence built from the engine's numbers instead.
- Under every answer that prices a purchase or a refund, the panel says which of those happened: "Checked" when Claude's sentence passed, or a note that the engine's summary replaced it.
- Nothing is charged until you approve the payment in PayPal's window.
- Refunds and the Pay in 4 comparison are plain code with no model call.
174 tests cover the path from a typed purchase to the ranked card, the order amount and the cap counter, plus refunds, webhooks, Pay in 4, the import and the CSV export.
Inspiration
Rewards apps count points. They leave out annual fees and interest.
Jordan, 24, has three cards. Last year he earned $552.69 in rewards and $80.00 in perks, and paid $325.00 in annual fees and $734.72 in interest on a $2,800 balance at 26.24% APR. Net, his cards cost him $427.03. Jordan is a sample person and his purchases are synthetic, but the card terms are real.
Monte is for people like him: several cards, maybe a balance, and no clear answer at the register about which card to use.
What it does
Monte reads a year of purchases and computes each card's net: rewards + perks used − fees − interest.
- Receipt: that net, per card and in total.
- Where it went: spending by store and category, month by month.
- Leaks: interest, fees that don't pay for themselves, recurring charges, each with its fix.
- Replay: the same year on the best card already in the wallet. Jordan gets $104.14 back.
- Every purchase: the card used vs. the right card, for all 576 of Jordan's purchases.
- Tap: the best card at a store, counting this quarter's caps, with PayPal checkout from there. Never a card carrying a balance.
- Pay this first: which balance to pay down first, and how long it takes.
- Keep or cancel: each annual fee against the value the card adds over the next-best card.
- Apply: the next card, ranked on your spending, not on referral fees.
- Next year ×1,000: each plan run over 1,000 simulated years.
- Wrapped: the year in eight cards.
How we built it
No language model touches the math. The engine is deterministic, and every dollar traces to a card rule and the purchases behind it.
- Card catalog: 29 cards. Each term has the issuer's source URL and the date we checked it (17 Oct 2026).
- Rules engine: earn rates, spending caps, shared cap pools, pick-a-category cards, quarterly rotations, statement credits, cash vs. travel point values.
- Monte Carlo: resamples your own months into 1,000 years and reruns the engine on each, so caps reset every year. Seeded. 19–313 ms.
- Solver check: a linear program assigns the whole year at once. It proves the card-by-card routing optimal on all three test wallets (gap $0.00), and on a hand-built cap trap it finds $33.00 where card-by-card gets $30.00.
- Provenance: click any dollar to see its rule, the arithmetic (purchase × earn rate × point value), the source and the date.
- Input: statement CSVs (Chase, Amex, Capital One), parsed in the browser; Plaid sandbox for transactions, APR and balances.
- PayPal:
lib/paypal/holds the PayPal client (OAuth, Orders, refunds, Transaction Search), the checkout agent and the Pay in 4 math. The browser loads PayPal's JS SDK v6 from the sandbox. - Backend (it runs once the Supabase keys are set): Supabase Postgres with row-level security on every table, and no card numbers stored.
/api/synccaches how much of each card's spending cap is used, and/api/tapreads that cache instead of replaying the year: the same card and reward to the cent on every test purchase, in about 3 microseconds instead of 3 milliseconds. - Speed: a year of 576 purchases routes in about 1 ms; 1,000 simulated years in about 58 ms.
- Stack: Next.js 16, TypeScript, React, Tailwind, D3, Supabase/Postgres, PayPal (sandbox), Claude Opus 5.5 and Haiku 5.5 (Anthropic SDK), javascript-lp-solver, Plaid (sandbox), Vercel. 174 tests, including hand-computed cases.
Adrian built the interface, the brand, the PayPal checkout and the checkout agent. Michael built the backend: Plaid, the solver, the Monte Carlo engine, the tests, and the PayPal refunds, Pay in 4 comparison, purchase import, webhooks, itemized orders, the agent's returns and the activity page.
Challenges we ran into
- Caps. Citi Custom Cash shares one $500 cap a billing cycle across categories, BofA Customized Cash one combined $2,500 a quarter, and Blue Cash Everyday has a separate $6,000 a year per category. Getting the pool keys right, and making the engine, the solver and the Monte Carlo use the same keys, took several passes.
- Caps broke our first Monte Carlo. Resampling monthly reward totals overstates capped cards, because a month is worth less once earlier months have used the cap. We switched to rerunning the engine on every simulated year, and wrote a script that measures the difference.
- Greedy can waste a cap on an early small purchase. We needed to know whether that cost anyone money, which is why the solver exists.
- Interest overrides rewards. A card with a balance gets no new spending, and Monte never suggests a new card while you carry one.
- PayPal's agent toolkit didn't fit. We tried
@paypal/agent-toolkit1.11.0. It has no Anthropic adapter, and its create-order tool takes item prices from the model, which Monte can't allow because the engine owns every number. We wrote two small tools instead:rank_cardsand acreate_paypal_orderthat takes no arguments.
What we learned
Interest decides most of the answer: Jordan's best move is paying down his balance, not a better rewards card. And when a system has limits like caps, you have to simulate the system, not the totals it produced. A cheap greedy is fine as long as you can prove it.
Real vs. simulated
- Real: the card terms and sources, the engine, Monte Carlo, the solver check, every number on the receipt, CSV upload, the PayPal and Plaid code.
- Sandbox: PayPal and Plaid run against their sandboxes only. No real money or real bank account has touched Monte.
- Simulated: the five demo people (Jordan, Maya, the Parks, Sam, Rosa) and their purchases. Tap is a web demo, not NFC.
- Estimates: Pay in 4 uses PayPal's published US terms, and Monte doesn't know whether PayPal would approve you. Card interest is an estimate (monthly compounding, not average daily balance).
- Needs keys: PayPal, the checkout agent, the Supabase backend and the merchant-name model run only when their keys are set. Without them, the site runs the engine in the browser.
- Flagged: 11 of the 29 cards are marked unverified and badged in the app. Jordan's cards are all verified.
What's next for Monte
- Turn the backend on in production, so Tap runs on real synced data.
- Production Plaid, and a background job that updates the cap cache as new purchases post.
- Confirm the 11 unverified cards and add published rotating categories for other quarters.
- Tell people when it is safe to open a new card after paying down a balance.
Built With
- anthropic
- claude
- claude-code
- d3.js
- framer-motion
- javascript-lp-solver
- matter.js
- next.js
- paypal
- plaid
- postgresql
- react
- supabase
- tailwindcss
- typescript
- vercel