Inspiration

Startups and growing teams waste thousands of dollars every month on recurring SaaS subscriptions and contractor invoices. Most of that waste happens because of two things:

First, companies guess whether to pay monthly or prepay annually. A 20% annual discount looks great on paper, but locking up cash right before quarterly tax bills can wipe out liquidity. Second, SaaS vendors quietly bump up contract prices mid-term. Nobody notices a 15% rate increase in a buried PDF until the card already got charged.

We wanted an AI agent that could handle the math, track contracts, and negotiate or dispute overcharges. But if you talk to any finance director, they will tell you the exact same thing: they will never give an autonomous LLM the keys to their bank account or PayPal credentials. One hallucinated parameter or prompt injection attack and your treasury balance is gone.

So we built VeriSpend AI around a hard principle: "The AI Agent Proposes. The Deterministic Engine Validates. The Human Authorizes. PayPal Executes."

What it does

VeriSpend AI acts as an autonomous corporate procurement controller that operates across three decoupled layers:

  1. Financial analysis: The AI reads incoming invoices and vendor contracts, monitors committed monthly burn, forecasts 45-day tax cash reserve buffers, and drafts proactive payment or discount proposals.
  2. Compiled zero-trust guardrails: Before any proposed payment can reach execution, our compiled TypeScript engine checks deterministic rules. It enforces a strict $15,000 reserve floor, caps contract price variances at 5%, and validates currency codes against an ISO-4217 allowlist. These rules live in compiled code, completely outside the LLM prompt, so prompt injections cannot bypass them.
  3. Human authorization and PayPal execution: When a proposal is valid, it appears as an authorization card inside AG Grid Enterprise. The finance lead clicks Approve, which triggers execution across PayPal REST APIs with unique idempotency keys (PayPal-Request-Id).

Key scenarios we built and tested:

  • Reserve floor defense: When a $38,000 annual prepayment for Snowflake is proposed, the guardrail calculates that remaining funds ($12,000) would breach the $15,000 reserve floor. It blocks payment immediately and flags the row POLICY BLOCKED in red.
  • Compliant SaaS execution: A standard OpenAI Enterprise bill ($1,200/mo) passes all four guardrails. One click authorizes the payment, captures the PayPal Order, updates the treasury balance to $48,800, and marks the record PAID.
  • Overcharge defense: When GitHub bills $4,800 against a $4,000 contract rate (+20% hike), the system flags the anomaly, audits the contract terms, and lets the user file a formal dispute directly through PayPal Disputes API.
  • Real-time surplus adaptation: When an incoming customer ARR payment ($60,000) hits via PayPal webhook, the agent re-evaluates runway and suggests pivoting from monthly to annual billing to pocket $9,000 in discounts.

How we built it

  • Frontend: Next.js 14 App Router styled with Tailwind CSS. We built three distinct operational views using AG Grid Enterprise v32: the Vendor Payment Tracker, the Transaction Audit Log with Server-Side Row Model (SSRM) virtual scrolling, and the Cash Flow Analyzer with integrated AG Charts donut breakdowns and sparklines.
  • PayPal REST APIs: We wired seven distinct services: Orders v2 (creation and capture), Invoicing v2, Subscriptions v1, Payouts v1 (batch contractor disbursements in USD, EUR, and GBP), Disputes v1, and Webhooks v1.
  • Database: Neon Serverless PostgreSQL with Drizzle ORM for type-safe queries and an append-only audit event log.
  • Deployment: Hosted on Vercel with Neon PostgreSQL connection pooling running at 59ms query latency.

Challenges we ran into

  • JavaScript float math in finance: 0.10 + 0.20 = 0.30000000000000004 is unacceptable in treasury operations. We converted all monetary math into integer cents and string decimals across Zod schemas and guardrails.
  • Keeping the agent propose-only: We physically excluded capture and payout credentials from the agent's tool definitions. The agent literally has no code path to disburse funds.
  • Synchronizing AG Grid SSRM with webhook events: Getting the server-side row model to update cleanly as webhook simulations fired required careful cache invalidation.

Accomplishments that we're proud of

  • The system passed 77 end-to-end tests across four testing tiers: feature coverage, boundary and adversarial injection tests, cross-feature state interactions, and real-world cash stress tests.
  • Live production deployment at https://verispend-ai.vercel.app with zero cold-start database lag.

What we learned

  • Security guardrails belong in compiled code, never in system prompts. Prompt engineering is a suggestion; compiled TypeScript is a guarantee.
  • PayPal's dispute and payout APIs are flexible enough to automate evidence packaging for vendor billing disagreements.

What's next for VeriSpend AI

  • Adding invoice OCR to parse incoming PDF invoices and cross-reference master service agreements automatically.
  • Connecting with the PayPal AI Toolkit to allow our agent to negotiate directly with vendor billing agents.

Built With

  • ag-charts
  • ag-grid-enterprise
  • ai-agents
  • autonomous-procurement
  • corporate-treasury
  • drizzle-orm
  • fintech
  • idempotency
  • neon-postgres
  • next.js
  • openai
  • paypal
  • paypal-disputes
  • paypal-orders-v2
  • paypal-payouts
  • react
  • saas-management
  • tailwind-css
  • typescript
  • vercel
  • zero-trust
Share this project:

Updates

Submission history