PayPilot — Autonomous AI Payment Agent

Inspiration

Online shopping is becoming increasingly intelligent, but giving AI agents the ability to make purchases introduces an important challenge: How can autonomous commerce become convenient without sacrificing financial control, security, and user trust?

I was inspired by the idea of building an AI-powered shopping assistant that goes beyond recommending products. I wanted to create a system that could understand a user's shopping intent, identify suitable products, enforce spending limits, and execute payments securely through PayPal.

This inspired me to build PayPilot, an autonomous commerce platform based on three principles:

AI proposes. Policy protects. PayPal executes.

My vision was to demonstrate how AI-powered purchasing could work alongside financial safeguards, transparency, and user control.

What it does

PayPilot is an AI-assisted autonomous commerce platform that connects product discovery, spending policy evaluation, and PayPal payments into a unified workflow.

Users can describe what they want in natural language, specify their budget, and explore matching products. Before checkout, PayPilot evaluates the purchase against predefined spending policies.

Its key features include:

  • Natural-Language Purchase Proposals: Converts shopping requests into structured product preferences, including category, budget, and minimum rating.
  • Intelligent Product Discovery: Searches and ranks products based on user requirements, price, and ratings.
  • Spending Policy Engine: Evaluates purchases against budget limits and explains why a purchase is eligible or rejected.
  • PayPal Integration: Creates PayPal Sandbox orders and allows buyers to approve and complete payments.
  • Transaction Dashboard: Displays transaction history, payment status, spending information, and individual transaction details.
  • Audit Timeline: Records important transaction events, including order creation and verified payment capture, with timestamps and metadata.
  • Policy Transparency: Displays budget comparisons, remaining budget, and individual policy checks to make purchasing decisions understandable.

An important design decision I made was to separate policy eligibility from payment authorization. Being within budget does not automatically authorize a payment.

How I built it

I independently designed and developed PayPilot using a modular frontend and backend architecture.

Frontend — Next.js, React, TypeScript, and Tailwind CSS

I developed the user interface using Next.js and React, with Tailwind CSS for styling. I implemented the product discovery experience, purchase workflow, transaction dashboard, transaction detail pages, and audit timeline.

Backend — Python and FastAPI

I built the backend using FastAPI to handle product search, natural-language purchase proposals, policy evaluation, checkout creation, and payment capture. I implemented financial validation using Python's Decimal arithmetic to ensure accurate budget comparisons.

Database — SQLite

I designed the SQLite transaction storage system to persist PayPal order IDs, capture IDs, product details, spending limits, payment statuses, and timestamps. I also implemented a persistent audit-event log to maintain a traceable record of important transaction lifecycle events.

Payments — PayPal Sandbox

I integrated PayPal REST APIs to handle OAuth 2.0 authentication, order creation, order retrieval, and payment capture. I implemented backend verification to check the completed capture, currency, and transaction amount before recording payment success.

Challenges I ran into

Building PayPilot independently involved several technical challenges that required careful implementation and testing.

1. Integrating the PayPal payment lifecycle

Creating an order and completing a payment are separate operations. I implemented order creation, buyer approval, capture, and backend verification as distinct stages to ensure the payment lifecycle was handled correctly.

2. Financial accuracy and budget enforcement

I needed consistent USD handling and accurate comparisons between product prices and spending limits. I used Python's Decimal arithmetic instead of relying on floating-point comparisons.

3. Persistent transaction tracking

I wanted transaction information to remain available beyond an individual checkout session. I implemented SQLite-based transaction records and a persistent audit-event system to maintain transaction history.

4. Payment verification and consistency

A successful API response alone was not sufficient to establish that a payment was completed. I added backend checks for PayPal order status, capture status, currency, and amount before considering a payment verified.

5. Frontend and backend integration

Connecting multiple API endpoints with the Next.js application required careful handling of API responses, transaction states, and database records. I worked through these integration issues to make the dashboard and transaction details reflect the backend data.

Accomplishments that I'm proud of

I'm particularly proud of building PayPilot independently, from the initial concept to a working full-stack application with PayPal Sandbox integration.

Some accomplishments I'm most proud of:

  • Successfully integrated PayPal Sandbox order creation and payment capture.
  • Built a spending policy engine with budget validation and decision explanations.
  • Implemented accurate financial comparisons using Decimal arithmetic.
  • Developed a transaction dashboard with individual transaction details.
  • Created a persistent audit timeline with transaction event metadata.
  • Implemented backend verification of PayPal payment captures.
  • Successfully tested the implemented backend functionality and transaction workflows.

Most importantly, I built a system that demonstrates how AI-assisted commerce can be combined with financial safeguards rather than allowing purchasing decisions to happen without control.

What I learned

Building PayPilot independently gave me valuable hands-on experience in full-stack development, payment integration, financial validation, and backend architecture.

I learned how to:

  • Integrate PayPal REST APIs and implement OAuth 2.0 authentication.
  • Design payment workflows with separate order creation and capture stages.
  • Build spending-policy evaluation using FastAPI.
  • Handle financial data accurately using Decimal arithmetic.
  • Design persistent transaction and audit-event systems using SQLite.
  • Connect frontend dashboards with backend APIs.
  • Implement payment verification and maintain transaction consistency.
  • Make purchasing decisions more transparent and explainable.

My biggest takeaway was that autonomous commerce should not mean uncontrolled spending. AI-powered purchasing systems need clear financial policies, reliable payment verification, and transparent records to earn user trust.

What's next for PayPilot — Autonomous AI Payment Agent

I envision evolving PayPilot into a more capable autonomous AI payment agent.

My future development plans include:

  • Advanced AI Reasoning: Improve how the agent understands shopping intent, evaluates alternatives, and explains purchasing recommendations.
  • Customizable Spending Policies: Allow users to define category-based budgets, transaction limits, and approval requirements.
  • Merchant Comparison: Compare products across merchants based on price, ratings, and user preferences.
  • Recurring Purchase Management: Support controlled recurring purchases with configurable spending rules.
  • Risk Monitoring: Introduce additional transaction-risk checks and suspicious-purchase detection.
  • Enhanced Auditability: Strengthen transaction traceability and policy-decision records.

My long-term goal is to make PayPilot a trusted financial control layer for AI-powered commerce, where intelligent agents can simplify purchasing while users remain in control of their money.

PayPilot — Shop smarter. Spend responsibly. Stay in control.

Built With

Share this project:

Updates

Submission history