Inspiration

Financial operations are often fragmented across invoices, spreadsheets, payment platforms and manual reconciliation processes. Businesses spend valuable time extracting invoice information, checking payment statuses, identifying discrepancies and investigating financial exceptions.

A seemingly small error can create significant problems: a duplicate payment may go unnoticed, a legitimate instalment may be flagged incorrectly, or an invoice may be marked as paid before the payment is actually completed.

I wanted to build a solution that addresses these challenges by bringing artificial intelligence and real payment infrastructure into one connected workflow.

My vision was to go beyond building another AI chatbot or payment dashboard. I wanted to create an intelligent financial operations platform where AI understands financial documents, PayPal facilitates payment processing, and deterministic financial logic ensures that every transaction is verified and accounted for.

That vision became INSIGHT AI.

What it does

INSIGHT AI is an AI-powered financial operations platform that connects invoice intelligence, PayPal payment processing and deterministic financial reconciliation.

Its core capabilities include:

1. Gemini-Powered Invoice Intelligence

  • Processes PDF and DOCX invoices.
  • Extracts invoice numbers, vendor and customer information, line items, taxes and totals using Google's Gemini API.
  • Produces structured invoice data.
  • Validates extracted financial information before persistence.
  • Supports human review before payment authorization.

2. PayPal Orders v2 Integration

  • Creates real PayPal Sandbox payment orders.
  • Provides buyer checkout and approval links.
  • Verifies buyer approval with PayPal before attempting capture.
  • Supports server-side payment capture.
  • Handles payment failures without falsely marking invoices as paid.

3. Deterministic Financial Reconciliation

The reconciliation engine identifies:

  • Fully matched payments.
  • Partial payments and legitimate instalments.
  • Duplicate payments.
  • Overpayments.
  • Refunds and disputes.
  • Unmatched payments and financial exceptions.

It uses deterministic, cents-based monetary calculations rather than relying on AI-generated financial decisions.

4. Webhook Security and Auditability

  • PayPal webhook signature verification.
  • Event idempotency.
  • Transaction tracking.
  • Auditable financial operations.
  • Exception identification and investigation.

5. Gemini Financial Intelligence Agents

The AI assistant uses grounded tool calling to interact with backend information, investigate financial discrepancies and support financial operations.

AI assists with understanding and investigation, while financial authorization, payment verification and reconciliation remain controlled by backend logic.

How we built it

INSIGHT AI was developed as a Docker-free, full-stack application using a modular backend architecture.

Our technology stack:

Component Technology
Frontend React, TypeScript
UI and Visualizations Tailwind CSS, Lucide React, Recharts
Backend Python, FastAPI
Database SQLite
AI Integration Google Gemini API
Payment Integration PayPal Orders v2
Document Processing PDF and DOCX extraction
Financial Calculations Deterministic Decimal-based calculations
Validation Pydantic
Testing Python unittest, FastAPI TestClient
Build System Vite

The application follows a clear separation of responsibilities:

  • Gemini understands unstructured financial documents.
  • FastAPI handles business logic and API communication.
  • PayPal processes payment orders and captures.
  • The reconciliation engine validates financial outcomes.
  • SQLite maintains persistent application records.

A central architectural principle is that AI should assist financial operations without independently authorizing transactions or determining whether money has been successfully received.

For financial calculations, we implemented cents-based arithmetic to avoid floating-point precision problems.

For PayPal, we implemented the Orders v2 lifecycle, including order creation, buyer approval verification and server-side capture.

Challenges we ran into

1. Maintaining financial accuracy

Financial applications cannot tolerate unreliable monetary calculations. We addressed this by implementing deterministic cents-based calculations and validation of subtotal, tax and invoice totals.

2. Integrating AI with deterministic financial systems

Gemini is useful for extracting information from unstructured documents, but extracted information must be independently validated. We separated AI interpretation from financial authorization and reconciliation.

3. Understanding the PayPal payment lifecycle

One major challenge was distinguishing order creation from buyer approval and actual payment capture. PayPal does not permit capturing an order before the buyer approves it.

We strengthened the integration by retrieving the actual PayPal order status and requiring an APPROVED status before attempting server-side capture.

4. Handling payment failures safely

A declined payment must not increase an invoice's received amount or incorrectly mark it as settled. We implemented failure handling and tested this behaviour.

5. Building reliable webhook processing

Payment events can be repeated or manipulated. We implemented webhook signature verification and idempotency to improve transaction integrity.

6. Dependency and frontend recovery

During local development, we discovered missing React/Vite configuration files. We reconstructed the frontend infrastructure around our existing application without replacing its main source code.

We also discovered three frontend dependency vulnerabilities, upgraded the affected dependencies and subsequently achieved zero reported npm audit vulnerabilities.

These challenges helped us understand that financial software needs more than successful API connections. It needs trustworthy state transitions, precise calculations and verifiable transactions.

Accomplishments that we're proud of

We are particularly proud of connecting AI-powered document understanding with an actual payment-processing workflow and a deterministic financial reconciliation engine.

Some important milestones include:

  • Developed a complete React and TypeScript financial operations dashboard.
  • Integrated Gemini for structured invoice extraction.
  • Implemented Gemini grounded tool-calling capabilities.
  • Integrated PayPal Orders v2 for Sandbox payment processing.
  • Implemented buyer-approval verification before payment capture.
  • Developed deterministic financial reconciliation.
  • Implemented payment failure protection and duplicate detection.
  • Added PayPal webhook signature verification and idempotency.
  • Implemented persistent SQLite data storage.
  • Built an automated backend test suite covering ten major integration and financial scenarios.

Validation results:

  • Backend automated tests: 10/10 passing.
  • TypeScript validation: Passed.
  • Vite production build: Passed.
  • Frontend dependency audit: Zero reported vulnerabilities.
  • Python dependency audit: Zero known vulnerabilities found.
  • Python dependency consistency: No broken requirements.

We also successfully published the project source code to GitHub:

https://github.com/BibinBinoy777/INSIGHT-AI

These milestones represent the working implementation and automated validation of the application. Full end-to-end live Sandbox transaction validation remains an important next step.

What we learned

Building INSIGHT AI taught us that artificial intelligence and financial reliability must work together.

We learned that AI is powerful for interpreting documents, extracting information and supporting investigations, but financial calculations and transaction authorization require deterministic, independently verifiable processes.

We gained practical experience in:

  • Gemini API integration and structured extraction.
  • AI agent development and grounded tool calling.
  • PayPal Orders v2 and payment lifecycle management.
  • Webhook security and event idempotency.
  • Financial reconciliation algorithms.
  • Decimal-based monetary calculations.
  • FastAPI backend architecture.
  • React and TypeScript development.
  • Database persistence and integration testing.
  • Dependency vulnerability management.

Perhaps our biggest lesson was that a financial application should never confuse an AI-generated interpretation, a created payment order and an actually completed payment. Each represents a different state that must be independently verified.

What's next for INSIGHT AI: Intelligent Financial Operations

INSIGHT AI is an evolving project, and our next goal is to strengthen it into a production-ready financial operations platform.

Our roadmap includes:

1. Security and Trust Hardening

  • Strong user authentication.
  • Role-based access control.
  • Organization-level authorization.
  • Secure financial approval workflows.
  • API rate limiting and abuse prevention.
  • Stronger database protection.

2. Advanced AI Financial Agents

Expand AI-powered financial investigations, automated exception analysis, invoice intelligence and explainable recommendations.

3. Deeper PayPal Integration

Complete end-to-end Sandbox transaction validation, improve webhook-driven transaction updates and strengthen payment lifecycle monitoring.

4. Advanced Financial Intelligence

Introduce richer financial analytics, cash-flow insights, outstanding-payment monitoring and reconciliation reporting.

5. Scalable Architecture

Explore PostgreSQL support, improved transaction monitoring and deployment-ready infrastructure while maintaining the existing Docker-free development experience.

Our long-term vision is to make financial operations more intelligent, transparent and trustworthy.

We believe AI should not merely generate answers; it should help build systems that solve real problems. INSIGHT AI represents that belief by combining Gemini intelligence, PayPal payment infrastructure and deterministic financial engineering into one connected platform.

Built With

Share this project:

Updates

Submission history