Inspiration
The initial inspiration for PUFI came from a simple question: What if businesses could coordinate complex payment operations through a single intelligent platform instead of manually handling multiple transactions across different payment providers?
We initially explored several PayPal-powered ideas: enabling direct purchases from social-media advertisements, simplifying bulk payments to agricultural suppliers and farms, facilitating cross-border payments between American companies and Indian manufacturers, and streamlining employee wage distribution.
Although these ideas addressed different problems, we identified a common challenge underlying them: managing multiple financial obligations efficiently while maintaining visibility over transaction costs, currency conversion, payment providers, and reconciliation.
From Ideas to PUFI
After evaluating the feasibility, technical complexity, and potential impact of our ideas, we narrowed our focus to Enterprise Bulk-Payment Coordination and Reconciliation.
This became the foundation of PUFI – an AI-assisted enterprise payment coordination and intelligent routing platform.
Instead of attempting to create another bank or payment network, we decided to build an intelligent coordination layer that works alongside existing payment providers. Its purpose is to help businesses prepare, analyse, approve, execute, and monitor payment obligations through a unified workflow.
What We Built
PUFI provides a centralised environment for managing supplier payment obligations and payment batches.
The application allows users to:
- Import and validate payment obligations.
- Identify invalid records and duplicate invoices.
- Organise multiple obligations into payment batches.
- Calculate estimated provider fees and foreign-exchange costs.
- Compare payment routes using cost, speed, and balanced optimisation strategies.
- Obtain AI-assisted financial recommendations.
- Review and approve payment decisions before execution.
- Submit eligible payment requests through the PayPal Payouts Sandbox integration.
- Monitor payment statuses and inspect audit records.
The platform also includes simulated payment providers to demonstrate route comparison and payment coordination independently of live provider availability.
How the System Works
PUFI follows a structured workflow.
First, payment obligations enter the system and undergo backend validation. Valid records are grouped into batches. The financial engine then evaluates available payment providers against their supported currencies, recipient types, transaction limits, and configured funding information.
Eligible providers are compared using estimated fees, foreign-exchange spreads, and processing times.
The routing engine supports three strategies:
- Lowest Cost: Prioritises the lowest estimated transaction cost.
- Fastest: Prioritises the shortest estimated processing time.
- Balanced: Combines normalised cost and processing-time scores using a weighted optimisation model.
The selected route is then presented for review. A human approval step is required before the application proceeds to the supported payment execution workflow.
The AI Engineering Behind PUFI
One of our most important engineering decisions was to avoid giving an AI model unrestricted authority over financial transactions.
We integrated Google's Gemini Flash API as an advisory intelligence component. It analyses sanitised payment-batch information, compares eligible routes, identifies potential concerns, and produces structured recommendations.
However, the actual financial calculations and provider eligibility checks are performed by deterministic backend algorithms.
The financial engine uses Python's Decimal arithmetic to minimise floating-point errors in monetary calculations.
For example, the variable provider fee is calculated using:
[ F_v = A \times \frac{b}{10000} ]
where (A) is the payment amount and (b) is the fee expressed in basis points.
Foreign-exchange estimates incorporate a configurable spread:
[ R_{\text{effective}} = R_{\text{quoted}}\left(1-\frac{s}{10000}\right) ]
where (s) represents the FX spread in basis points.
For balanced routing, the engine combines normalised cost and processing time:
[ S = 0.6C_n + 0.4T_n ]
where (C_n) and (T_n) represent normalised cost and time scores. The route with the lowest score is prioritised.
The AI recommendation is checked against the deterministically eligible provider list. If the AI response is unavailable, malformed, or recommends an ineligible provider, the system falls back to deterministic routing.
This architecture keeps financial calculations, approval authority, and payment execution under backend control rather than relying on an AI-generated response.
Challenges and What We Learned
One of our major challenges was integrating the PayPal Payouts API.
We successfully verified the Sandbox OAuth authentication flow. However, our Payouts API request encountered a 403 PAYOUT_NOT_AVAILABLE response, preventing us from demonstrating a successful external payout. We retained the integration architecture and developed simulated provider pathways to demonstrate the remaining coordination workflow.
Other challenges included designing reliable monetary calculations, preventing duplicate payment instructions, handling uncertain provider responses, structuring the AI output, and maintaining clear boundaries between AI recommendations and financial authorisation.
Our backend test suite contains 135 passing tests, covering validation, financial calculations, routing, approval, provider integration logic, reliability, and other core workflows.
What's Next?
PUFI is currently a working prototype with a foundation designed for further development.
Our future objectives include obtaining eligible PayPal Payouts access, integrating live foreign-exchange data, connecting authorised banking and payment-provider services, improving reconciliation, introducing production-grade authentication and multi-tenant infrastructure, and exploring enterprise payroll and social-commerce payment integrations.
Ultimately, our vision is to make complex enterprise payment operations more transparent, coordinated, and intelligent while keeping financial authority secure, deterministic, and accountable.
PUFI – Intelligent coordination. Transparent decisions. Controlled payments.
Built With
- alembic
- decimal-arithmetic
- fastapi
- gemini-flash
- git
- google-gemini-api
- paypal-payouts-api
- paypal-sandbox
- pydantic
- pytest
- python
- react
- rest-api
- sqlalchemy
- sqlite
- tanstack-query
- typescript
- vite