Inspiration
Merchants often face uncertainty around when payments will arrive, how refunds will affect their cash position, and what happens when payment disruptions continue over several days. We wanted to address a key question: What if merchants could anticipate the potential impact of payment disruptions before they affect their liquidity?
This inspired PayPulse — an AI-powered counterfactual payment intelligence platform that combines generative AI with quantitative simulations to help merchants understand, explore, and prepare for different payment-risk scenarios.
What it does
PayPulse allows merchants to ask financial and operational "what if?" questions in natural language and receive simulation-backed insights.
For example: "What happens to my liquidity if payment delays increase and refunds rise over the next 10 days?"
Its key capabilities include:
- AI Analyst: Uses Google Gemini to interpret merchant questions and extract relevant simulation parameters.
- Monte Carlo simulations: Runs thousands of scenarios to explore possible cash-flow outcomes.
- Payment event modelling: Simulates delayed payments, refunds, outstanding payment backlogs, and operational disruptions.
- Disruption modelling: Explores independent and persistent stress scenarios using Markov-style regime transitions.
- Risk analytics: Calculates reserve-breach probability, Value at Risk (VaR), and Conditional Value at Risk (CVaR).
- Liquidity forecasting: Visualizes projected cash balances and risk ranges through an interactive dashboard.
- PayPal Sandbox integration: Supports Sandbox authentication, checkout order creation, and an order-capture API endpoint.
The key idea is that AI does not invent financial predictions. The simulation engine calculates the results, while Gemini translates the findings into explanations that merchants can understand.
How we built it
We built PayPulse using a modular full-stack architecture:
- Frontend: React, Vite, Tailwind CSS, Recharts, and Axios for the interactive dashboard, AI Analyst, and liquidity visualizations.
- Backend: Python and FastAPI to manage API requests, validate simulation configurations, and connect the different components.
- AI integration: Google's Gemini API using
google-genaifor natural-language parameter extraction and explanations of simulation results. - Simulation engine: NumPy and Pandas for Monte Carlo simulations, event-driven payment modelling, refunds, payment delays, disruption regimes, and liquidity risk calculations.
- Payment integration: PayPal REST APIs in Sandbox mode for OAuth authentication and checkout order creation, with a capture endpoint implemented.
- Testing: pytest for automated backend and simulation testing.
We started with a deterministic baseline simulation, expanded it into Monte Carlo and event-driven models, introduced disruption regimes and risk metrics, and then connected the analytical engine to Gemini and the React dashboard.
Challenges we ran into
One major challenge was connecting an LLM to a numerical simulation engine reliably. Gemini could return parameters in unexpected formats or data types, which could cause numerical computation errors. We addressed this through parameter validation, type conversion, and keeping the simulation engine independent of AI-generated explanations.
Another challenge was modelling disruptions beyond simple random payment delays. Real operational stress can persist across multiple days, so we explored Markov-style transitions to model changes between normal and stressed regimes and understand their impact on liquidity risk.
PayPal Sandbox integration also presented challenges. Authentication and order creation worked successfully, but international-regulations restrictions prevented us from completing an end-to-end buyer approval and capture flow. We documented this limitation rather than claiming an unverified successful transaction.
Finally, integrating the AI layer, backend, simulation engine, and frontend while maintaining reliable outputs required continuous testing and debugging.
Accomplishments that we're proud of
- Built a working full-stack fintech prototype combining AI, quantitative research, and payment integration.
- Developed a Monte Carlo simulation engine capable of exploring thousands of possible liquidity outcomes.
- Implemented event-driven modelling for payment delays, refunds, and outstanding payment backlogs.
- Explored persistent disruption regimes and their impact on downside liquidity risk.
- Integrated Gemini into a structured analytical workflow where numerical results are computed by the simulation engine rather than generated by the LLM.
- Implemented PayPal Sandbox authentication and checkout order creation.
- Built an interactive dashboard that makes complex simulation results easier to explore and understand.
- Developed and ran an automated pytest suite to validate core functionality.
Most importantly, we are proud of bringing together quantitative modelling and generative AI to address a practical problem in merchant payment operations.
What we learned
Building PayPulse taught us that meaningful AI in fintech requires more than simply integrating a language model. Financial insights need to be grounded in reliable calculations, validated inputs, and transparent assumptions.
We gained hands-on experience with Monte Carlo simulation, event-driven modelling, liquidity risk metrics such as VaR and CVaR, LLM integration, FastAPI, React, PayPal Sandbox APIs, and full-stack system integration.
We also learned how important it is to distinguish between simulated outcomes and real-world financial data, especially when building applications involving payments and merchant liquidity.
What's next for PayPulse
We envision developing PayPulse into a more comprehensive merchant intelligence platform.
Our next steps include:
- Integrating historical merchant transaction data to calibrate simulation assumptions.
- Improving payment-delay and refund models using real operational patterns.
- Expanding scenario analysis to cover more complex payment disruptions.
- Deepening PayPal payment lifecycle integration and validating end-to-end Sandbox capture.
- Introducing merchant-specific profiles, configurable risk thresholds, and personalized liquidity recommendations.
- Exploring proactive alerts when projected liquidity approaches a merchant's reserve threshold.
Our long-term goal is to help merchants move beyond understanding what has happened and start exploring what could happen next — and how to prepare for it.
PayPulse: Turning payment uncertainty into actionable liquidity intelligence.