PalPay AI The Intelligent Payment Agent

Inspiration

The inspiration behind PalPay AI — The Intelligent Payment Agent came from a common problem in digital transactions: How can payments become more trustworthy when money depends on the completion of a task or service?

Imagine hiring a freelancer to design a website. You agree to pay them once the work is completed, but how do you verify that they have fulfilled the requirements before releasing the payment?

Traditional payment systems are excellent at transferring money, but they don't always provide a built-in way to evaluate whether agreed conditions have been satisfied.

I wanted to explore a smarter approach where artificial intelligence could help evaluate submitted evidence, humans could intervene when necessary, and payments could be processed through a secure, transparent workflow.

This inspired me to build PalPay AI, a conditional payment platform that combines Google Gemini AI, human oversight, and PayPal's payment infrastructure.

My vision is simple: Don't just automate payments. Make payment decisions smarter, safer, and more accountable.

What it does

PalPay AI is an AI-powered conditional payment platform that helps users create payment agreements, evaluate evidence of completed work, and process authorized payments.

Instead of immediately releasing money, the platform follows a structured verification and approval process.

Here's how PalPay AI works:

  1. Create a SmartPay Rule: A user creates a payment agreement specifying the recipient, payment amount, description, and conditions that must be fulfilled.

  2. Submit Evidence: Once the task is completed, supporting evidence is submitted for evaluation.

  3. AI-Powered Review: Google Gemini analyzes the submitted evidence against the agreed payment conditions and generates a recommendation, confidence score, and explanation.

  4. Human Intervention: If the AI cannot confidently verify the evidence, the rule enters a human-review workflow. An authorized operator can request additional evidence or reject the submission.

  5. Evidence Resubmission: When more evidence is requested, a new submission can be provided and reviewed without overwriting previous evidence.

  6. Payment Authorization: When Gemini recommends approval, a separate human authorization step is required before payment can proceed.

  7. PayPal Sandbox Payout: After the necessary approvals, PalPay AI can initiate a payout through the PayPal Sandbox API.

  8. Payment Tracking and Auditing: PayPal webhooks and reconciliation services track payment results, while submission and review histories preserve an audit trail.

The platform also includes an interactive dashboard featuring payment analytics, recent payout activity, review queues, payment histories, and visual payment-progress tracking.

PalPay AI doesn't automatically release funds simply because an AI model recommends approval. It combines intelligent evaluation with explicit authorization and payment-status verification.

How I built it

I developed PalPay AI independently, handling the backend architecture, AI integration, payment processing, frontend development, testing, and debugging.

Backend Development

I used Python and FastAPI to build the backend, exposing REST APIs for SmartPay rule creation, evidence submission, AI review, human authorization, and payment processing.

I used SQLAlchemy and SQLite to manage payment rules, evidence submissions, payout records, verified PayPal webhook events, and human-review decisions.

I implemented a state-based payment workflow to control which operations are permitted at each stage.

Artificial Intelligence

I integrated Google Gemini AI to evaluate submitted evidence against predefined payment conditions.

Gemini produces recommendations such as approval, rejection, or the need for additional review.

When the available evidence cannot be independently verified, I designed the system to direct the case to a human reviewer instead of treating the submitted description as conclusive proof.

PayPal Integration

I integrated the PayPal Payouts API in Sandbox mode to demonstrate conditional payment execution.

To improve payment reliability, I implemented:

  • Protected payout endpoints and receiver confirmation
  • Duplicate payout prevention
  • Signed PayPal webhook verification
  • Webhook event storage and retry processing
  • Payout-status reconciliation
  • Protection against certain stale or conflicting payment updates

Frontend Development

I built the frontend using React, JavaScript, CSS, and Vite.

I designed an interactive dashboard where users can create SmartPay agreements, submit evidence, review AI recommendations, record human decisions, and monitor payment progress.

I also made the application responsive for desktop and mobile devices.

Testing and Version Control

I used Pytest to test backend behavior, including payment authorization, review decisions, evidence resubmissions, duplicate protection, and webhook processing.

I managed the source code using Git and GitHub and documented the project for other developers and hackathon judges.

I developed and tested payment functionality using PayPal Sandbox, allowing me to demonstrate payouts without transferring real money.

Challenges I ran into

Building PalPay AI independently presented several technical challenges that helped me better understand AI-powered financial workflows.

1. Integrating AI into payment decisions

One of my biggest challenges was determining how to use AI responsibly when evaluating task completion.

Gemini could analyze descriptions and provide useful recommendations, but it could not always independently verify external evidence such as website links.

I addressed this limitation by introducing human review, allowing uncertain submissions to be examined further instead of automatically authorizing payments.

2. Preventing duplicate payments

Payment systems must handle repeated requests carefully. A network error or repeated button click shouldn't result in multiple payouts for the same agreement.

I addressed this by introducing conditional database updates, unique payout records, and payment-state validation before initiating PayPal requests.

3. Handling PayPal webhooks

Integrating PayPal webhooks was more challenging than simply receiving notifications.

I had to verify webhook signatures, handle repeated events, retry interrupted processing, and reconcile payout information against PayPal's records.

I also worked on preventing outdated payment information from incorrectly replacing confirmed payment states.

4. Managing complex payment statuses

As the project grew, the number of possible states increased significantly.

I needed to distinguish between evidence awaiting review, human rejection, payment authorization, payout submission, uncertain outcomes, and completed payments.

I designed a structured workflow to ensure that each action occurred only when the payment rule was in an eligible state.

5. Connecting the backend and frontend

Integrating FastAPI with React introduced challenges involving API authentication, component imports, dynamic status updates, and conditional rendering.

I resolved these issues through incremental testing and by keeping frontend components focused on specific responsibilities.

6. Protecting sensitive repository data

During GitHub preparation, I discovered that my local SQLite database had been included in earlier commits.

I cleaned the published Git history, updated .gitignore, and created an .env.example template to separate private configuration from public source code.

This experience reinforced the importance of implementing security practices throughout development, not just before deployment.

Accomplishments that I'm proud of

One of my biggest accomplishments was building an application that connects AI-based evidence evaluation to a functioning payment workflow.

My key achievements include:

  • Successfully integrating Google Gemini AI with a conditional payment system.
  • Implementing human review with recorded decisions and explanations.
  • Building an evidence-resubmission workflow that preserves previous submissions.
  • Integrating PayPal Sandbox payouts with webhook-based payment tracking.
  • Developing payment analytics, transaction history, and visual payment-progress timelines.
  • Building a responsive frontend for desktop and mobile devices.
  • Creating automated backend tests covering important business rules and payment safeguards.
  • Preparing a documented GitHub repository for the project.

During development, I successfully demonstrated:

Metric Result
SmartPay rules created 6
Confirmed PayPal Sandbox payouts 3
Confirmed Sandbox payout volume $25.01
Human-review workflow Successfully demonstrated
Evidence resubmission and second AI review Successfully demonstrated

I'm especially proud of demonstrating a complete review cycle in which Gemini identified uncertain evidence, a human requested additional information, new evidence was submitted, and Gemini reviewed the latest submission while preserving the earlier records.

This demonstrated how AI and human oversight can work together in a financial workflow without automatically releasing money when evidence remains uncertain.

Another accomplishment I'm proud of is building the entire project independently. From backend development and AI integration to frontend design, debugging, and testing, I gained hands-on experience managing a complete software project.

What I learned

Building PalPay AI helped me develop practical skills in AI engineering, backend architecture, payment integration, and secure software development.

First, I learned that AI should support important decisions rather than operate without safeguards. Even advanced language models can encounter incomplete or unverifiable evidence. Human intervention becomes valuable when uncertainty could affect financial transactions.

Second, I gained a deeper understanding of REST API development with FastAPI, including request validation, authentication, database transactions, and error handling.

Third, I learned how financial systems require strong attention to idempotency, state transitions, and reconciliation. Sending a payment request is only one part of the process; tracking its outcome reliably is equally important.

I also learned the importance of automated testing. As my system grew, regression tests helped me improve functionality while reducing the risk of breaking existing workflows.

On the frontend, I improved my understanding of React state management, reusable components, API integration, and responsive design.

I also became more comfortable debugging complex problems, reading error messages, and breaking large technical challenges into smaller, manageable steps.

Most importantly, I learned that building an AI product is about more than connecting an AI model to an API. It involves combining intelligence, business logic, user experience, accountability, and appropriate security controls into one coherent system.

What's next for PalPay AI — The Intelligent Payment Agent

PalPay AI is currently a working hackathon prototype using PayPal Sandbox. My long-term goal is to develop it into a more complete intelligent conditional payment platform.

My next priorities include:

1. Real User Authentication and Role-Based Access

I plan to introduce secure user accounts and distinct roles for clients, service providers, and authorized reviewers.

2. Stronger Evidence Verification

I want to expand beyond text-based evidence evaluation by supporting file uploads, screenshots, structured evidence analysis, and appropriate verification of external resources.

3. Smarter AI Review Capabilities

I plan to improve Gemini's evaluation workflow with more structured criteria, clearer explanations, and better handling of uncertain evidence.

4. Improved Payment Security

I intend to strengthen concurrent transaction handling, webhook reconciliation, authorization boundaries, and payment ownership checks.

5. Better User Experience

I plan to introduce notifications, clearer review timelines, improved analytics, and more comprehensive activity tracking.

6. Production Infrastructure

I aim to move from my local development database to production-suitable infrastructure, implement secure credential management, and complete the security and compliance work required before supporting real-money transactions.

7. Broader Use Cases

I want to explore how PalPay AI could support freelance milestones, project deliverables, service agreements, and other payments dependent on verifiable conditions.

My Vision

I believe the next generation of payment platforms can do more than transfer money.

They can help people establish agreements, evaluate progress, manage uncertainty, and make payment decisions with greater transparency.

PalPay AI — The Intelligent Payment Agent: Where artificial intelligence meets accountable payments.

GitHub Repository: https://github.com/Andrew628-ops/palpay-ai

Current environment: PayPal Sandbox demonstration only.

Share this project:

Updates

Submission history