💡 Inspiration
Group event treasury management is fundamentally broken. Organizers of hackathons, workshops, and community summits waste hours chasing unpaid attendees across fragmented group chats, manually verifying easily forged payment screenshots, and reconciling multi-currency spreadsheets under tight deadlines.
I built LedgerMint to transform event collections from an error-prone manual chore into an autonomous, trust-minimized financial treasury—combining Google Gemini for natural language operations with PayPal Invoicing REST API v2, Cashfree UPI, and cryptographic settlement proofs.
🏗️ System Architecture & Core Pillars
LedgerMint is designed around a strict separation between AI intelligence and deterministic financial execution—ensuring that while AI handles orchestration and insights, the ledger remains 100% mathematically sound and tamper-proof.
1. Autonomous Event & Multi-Provider Payment Engine
- Natural Language Event Provisioning: An organizer describes an event in plain English (e.g., "Create a PayPal DevFest for 60 developers at $25"). Google Gemini 3.1 Flash-Lite parses structured constraints and provisions a live event portal.
- Backend-Controlled Payment Routing: A provider-independent payment abstraction (
PaymentOrder,PaymentAttempt,PaymentTransaction,PaymentWebhookEvent,PaymentRefund) dynamically routes transactions:- International / USD Transactions: Routed to PayPal Invoicing v2, creating official server-side itemized invoices (
INV2-...), transitioning them fromDRAFTtoSENT(send_to_recipient: false), and extracting official PayPal QR codes directly from raw multipart payloads. - Domestic Indian INR Transactions: Routed to Cashfree Payments Sandbox for native UPI checkout and dynamic order-linked QR codes.
- International / USD Transactions: Routed to PayPal Invoicing v2, creating official server-side itemized invoices (
2. Zero-Trust Webhook Reconciliation & Decimal-Safe Ledger
- Frontend Redirects Are Never Trusted: A payment is never marked
PAIDbased on a client redirect or uploaded screenshot. - Cryptographic Webhook Verification: Incoming webhook events (
/api/webhooks/paypaland Cashfree listeners) undergo strict signature verification and event-ID deduplication before updating the database. - Floating-Point Elimination: All monetary arithmetic enforces Python's
Decimaltype with explicit ISO currency isolation—never summing INR and USD without an audited conversion rate and timestamp.
3. Grounded AI Financial Copilot (Human-in-the-Loop)
- Powered by Google Gemini 3.1 Flash-Lite, the floating copilot is strictly grounded in real-time database telemetry.
- Organizers can query "Who hasn't paid yet?", inspect collection velocity, and generate personalized payment reminder drafts—with mandatory human-in-the-loop approval before any communication is dispatched.
4. Cryptographic Settlement & One-Click PDF Audit
When an event closes, LedgerMint freezes the canonical ledger state, computes an SHA-256 digest signed with ECDSA, and generates an executive financial audit PDF:
$$H_{\text{settlement}} = \text{SHA256}\Big(\text{EventID} \parallel \text{CanonicalLedgerJSON} \parallel \text{Timestamp}_{\text{UTC}}\Big)$$
Digital Signature Generation
σ = Sign_ECDSA(sk_organizer, H_settlement)
🏗️ How EventLedger AI Works
EventLedger AI is built around five connected layers:
Flutter Web Application: Provides event management, participant registration, unified checkout, Financial Hub, AI assistant and audit reporting.
FastAPI Backend: Manages application APIs, payment orders, financial analytics, provider integrations and webhook processing.
Payment Orchestration: Connects PayPal Sandbox for eligible international payments and Cashfree for the intended domestic INR payment workflow.
Financial Intelligence: Combines available financial records, account aggregation demonstration workflows and Google Gemini-powered financial insights.
Cryptographic Audit: Uses SHA-256 hashing, ECDSA digital signatures and PDF reporting to support settlement integrity verification.
Technology flow:
Flutter Web → FastAPI → Payment Orchestration → PayPal / Cashfree
FastAPI → Financial Hub → Gemini AI
FastAPI → Settlement Verification → SHA-256 / ECDSA → PDF Audit Report
🏔️ Engineering Challenges & How I Solved Them
- Extracting Official PayPal QR Codes from Multipart Payloads:
- Challenge: PayPal's
/v2/invoicing/invoices/{id}/generate-qr-codeendpoint returns amultipart/relatedresponse containing raw image/base64 boundaries rather than a standard JSON wrapper. - Solution: Built a custom MIME boundary parser in Python to cleanly extract and validate the raw Base64 QR payload directly from PayPal's sandbox response stream.
- Challenge: PayPal's
- Preventing AI Hallucinations in Financial Data:
- Challenge: LLMs can hallucinate balances or miscalculate unpaid totals if given raw unstructured context.
- Solution: Decoupled calculation from generation. Python computes exact
Decimalaggregations first, injecting read-only verified JSON telemetry into Gemini's system context so the LLM acts purely as an analytical interface.
- Idempotent Multi-Provider State Machines:
- Challenge: Payment gateways retry webhooks during network blips, risking duplicate ledger entries.
- Solution: Implemented unique provider event ID constraints and atomic database transactions so duplicate webhooks safely return
200 OKwithout mutating balances.
🧪 Automated QA & API Validation with Postman
Rather than treating API testing as an afterthought, I built a full Postman Collection & Environment Suite (EventLedger Local and EventLedger Sandbox) validating:
- OAuth 2.0 token lifecycle and PayPal Invoicing v2 state transitions (
DRAFT->SENT->PAID). - Currency mismatch rejections, idempotent webhook replay protection, and automated schema assertions via Newman CLI.
📚 What I Learned
Building LedgerMint reinforced a critical architectural rule for AI fintech: let AI handle intent, ambiguity, and communication, while deterministic code and cryptographic proofs guard every cent. Mastering PayPal's Invoicing v2 lifecycle, webhook signature verification, and multi-provider payment abstractions gave me deep hands-on experience designing resilient financial infrastructure.