Inspiration
AI purchasing assistants can recommend what to buy, but what happens when the terms change before payment? A price increase can exceed the budget. A cheaper substitute can be incompatible. An earlier approval should not silently authorize a different purchase.
I built SpendBrief to explore that gap: keeping the buyer’s approval attached to the exact quote they pay for, with a clear record of every change.
What it does
SpendBrief turns a plain-language purchasing request into a reviewed brief and compatible product baskets.
The buyer confirms their budget and requirements, chooses a basket, and approves a specific quote version. If a simulated supplier update changes the price or substitutes an item, the previous approval no longer applies. Budget and compatibility failures block approval and payment.
The buyer can compare alternatives, revisit a more expensive basket, or simulate a price reduction. Each revision requires fresh approval before continuing to PayPal sandbox checkout.
After payment, a decision receipt connects the confirmed brief, quote revisions, approvals, and verified PayPal order and capture references.
How we built it
SpendBrief uses Next.js, React, and TypeScript.
OpenRouter routes structured-output requests to Anthropic Claude Haiku 4.5 for requirement extraction and recommendation selection. Application code enumerates eligible baskets and checks their prices, budget, and compatibility against an authored demo catalogue. The model selects from verified candidates rather than inventing products or prices.
The PayPal Orders API creates and captures sandbox orders. Signed checkout records bind the order to the approved quote. The server checks the quote version, amount, currency, and quote digest before capture, and verifies a completed capture before displaying payment confirmation. Stable request identifiers support retries, and quotes freeze when checkout is reserved.
Local JSON storage preserves quote versions, approvals, and payment references. The current build is a single-user local prototype.
Challenges we ran into
The hardest part was keeping recommendations, approvals, and payments consistent when the purchase changed.
We needed to reject stale approvals, distinguish an approved PayPal order from a completed payment, and recover from interrupted checkout without creating replacement orders. Popup checkout also proved unreliable in the development browser, so we implemented same-tab checkout with return and cancellation handling.
Another challenge was explaining why a cheaper option could still fail the brief. Showing the changed connection requirement alongside the price made that decision clearer.
Accomplishments that we're proud of
SpendBrief completes the journey from a natural-language request to a verified sandbox payment and a decision receipt.
The prototype demonstrates price increases, price reductions, incompatible substitutions, alternative selection, and explicit reapproval. Successful sandbox payments have been confirmed against revised amounts and quote versions.
All 29 automated tests and the production build passed during submission preparation. Tests cover budget and compatibility checks, stale approvals, signed checkout records, payment retries, frozen quotes, and payment verification.
What we learned
Approval is a decision about specific terms, not a permanent permission to purchase.
A lower price does not automatically satisfy the buyer’s requirements. AI can help interpret intent and compare options, while deterministic checks enforce the purchasing constraints.
We also learned that interrupted-payment recovery and decision history deserve as much attention as the initial recommendation.
What's next for SpendBrief
Add Supabase authentication, per-user access controls, and transactional database storage, followed by a hosted deployment. Expand evaluation of the AI brief extraction and explore real supplier integrations.
The current prototype uses six demo products and controlled supplier changes. These future capabilities are not yet implemented.
Built With
- anthropic
- claude
- codex
- next.js
- node.js
- openai
- openrouter
- paypal
- react
- typescript