Inspiration
An AI purchasing agent can recommend an offer without fully accounting for recurring charges, spending limits, or approval requirements. For teams buying digital tools and licences, the important question is whether the proposed purchase satisfies their rules—and whether the eventual payment matches what was approved.
SpendProof explores that problem by connecting purchase intent, source evidence, policy checks, human approval, and verified PayPal sandbox outcomes in one workflow.
What it does
SpendProof helps an operator turn a purchasing brief into a reviewed, traceable sandbox purchase.
The demonstration requests three design licences with a $60 limit and no recurring billing. A $36 monthly offer is blocked because it renews. AI proposes a $54 one-time alternative, and the server independently evaluates nine checks covering quantity, currency, merchant, quoted terms, evidence, billing, spending caps, and available allowance.
The operator can inspect both proposal versions before approving the exact proposal and policy version. Approval expires and must be renewed or replaced when its conditions change.
PayPal then collects separate buyer consent. SpendProof verifies the provider outcome before recording capture, and supports reconciliation and a completed full refund. The proof ledger connects these outcomes to their proposal history, approval, provider references, and verified webhook receipts.
Native AG Studio adds an interactive analysis workspace. Custom widgets display allowance, proposal comparisons, and the decision timeline. Its AI assistant can inspect six connected datasets, build native reports, arrange widgets, and support linked chart and table exploration. Report layouts can be saved without changing purchase or payment authority.
Additional features include recurring-cost projections, hypothetical policy previews, nine policy scenarios, recovery simulations, and redacted proof exports.
How it was built
The frontend uses React and TypeScript. A Hono API runs on Cloudflare Workers, with D1 storing purchases, reservations, policy versions, approvals, notification receipts, and report layouts.
Groq supports structured purchase proposals and report assistance. Zod validates structured inputs, while server-side rules calculate amounts and determine whether a proposal is allowed, blocked, or requires review.
PayPal sandbox Orders and Payments APIs provide order creation, buyer approval, capture, reconciliation, and refunds. Webhook signatures are verified, and repeated deliveries are tracked separately from financial entries.
AG Studio provides the native reporting editor, custom widgets, linked data exploration, and an agent harness with bounded inspection and layout-editing tools.
Challenges
The central challenge was keeping a model recommendation, human approval, buyer consent, and payment completion distinct. Each represents a different level of authority and requires its own evidence.
Payment uncertainty also needed explicit handling. A browser return or a missing response cannot establish success, so unresolved outcomes retain their accounting state until reconciliation or investigation resolves them.
Report assistance introduced another challenge: invalid tool arguments must produce a controlled failure or bounded correction, rather than an invented successful result.
Accomplishments
A provider-backed hosted test completed a $54 PayPal sandbox capture and full refund. Reconciliation preserved the original capture, and repeated signed notifications did not add duplicate financial entries.
The implementation passed 52 application tests and 16 setup and packaging tests, alongside TypeScript checks and production builds. Native Studio report editing, saved layouts, and live AI behavior were also exercised separately.
What was learned
Reliable AI purchasing requires clear authority boundaries. Models can help interpret intent and explore alternatives, while explicit rules, human approval, and provider confirmation determine what may proceed and what actually completed.
Connecting those decisions to payment evidence also makes analytics more useful: an operator can inspect why an offer failed, compare revisions, and follow a purchase through its financial outcome.
What is next
The next priorities are broader catalogue coverage, stronger reviewer identity and access controls, and additional recovery testing.
The current implementation deliberately uses four fictional offers, one controlled merchant, USD, one-time captures, and full refunds. All payments use PayPal sandbox funds; no real goods are delivered.
Built With
- aggrid
- agstudio
- cloudflare
- css3
- groq
- hono
- paypal
- react
- sqlite
- typescript
- vite
- workers
- zod