1. Inspiration
Every year,businesses lose $2.9 billion+ (FBI IC3 2023) to vendor invoice fraud. According to the FBI Internet Crime Complaint Center (IC3), business email compromise and related payment-redirection scams pose a significant financial threat. One particularly dangerous attack involves a hacker sending a convincing invoice using the correct vendor name and payment amount while silently replacing the legitimate PayPal payout address with their own.
Most payment systems process these changes without independently verifying the recipient.
We asked ourselves: What if the payment system could detect and quarantine unauthorized payee changes before a single dollar moves?
That question led to the development of VendorTrust.
2. What It Does
VendorTrust is an AI-powered Verified Payee Change Protocol designed to prevent vendor invoice payment fraud. It uses a four-gate verification system to detect suspicious changes to payment recipients on incoming vendor invoices and enforce multi-party authorization before executing any PayPal payout.
Core Principle:
An invoice may request a new PayPal recipient, but it can never authorize that change.
3. The Four-Gate Verification Protocol
Gate 1 – AI-Powered Document Analysis
Google Gemini analyzes incoming invoices and extracts the proposed payment recipient. A deterministic policy engine compares the extracted recipient against the vendor's previously verified records. If a mismatch is detected, the payment is immediately placed on HOLD. No money moves without verification.
Gate 2 – Out-of-Band OTP Verification
VendorTrust generates and sends a one-time verification code exclusively to the vendor's pre-registered trusted contact. The OTP is never sent to the new address mentioned in the suspicious invoice. The vendor can either confirm the requested change or report it as fraudulent.
Gate 3 – Dual-Custody Approval
The employee who submits an invoice cannot approve their own payee-change request. A separate finance approver must independently review the request and its complete audit trail before granting approval. This restriction is enforced at the database and backend levels, rather than relying solely on frontend controls.
Gate 4 – Immutable Payee Lock and PayPal Payout
Once the change receives all required approvals, VendorTrust creates an append-only vendor version record. Database triggers prevent existing vendor records from being updated or deleted.
During payout execution, the system internally resolves the recipient from this immutable verified record. It never accepts a caller-supplied email address as the payout destination. The integration has been verified at the individual payout-item level using the PayPal Sandbox environment.
4. How We Built It
We developed VendorTrust using the following technologies:
- Backend API: FastAPI (Python)
- AI Document Analysis: Google gemini-3-flash-preview via LangChain
- Payment Integration: PayPal Payouts API (Sandbox)
- Database: SQLite with immutability triggers
- OTP Verification: Cryptographically secure, single-use, expiry-enforced OTP
- Audit Trail: SHA-256 tamper-evident event log
- Frontend: Bootstrap 5 with a dark theme and dual-role interface
- Deployment: Render (live deployment)
- Security Testing: 100 automated pytest tests
5. Challenges We Ran Into
1. PayPal Item-Level Verification
PayPal's Payouts API reports payout status at the batch level by default. To obtain accurate payment confirmation, we implemented item-level status polling using the items/{item_id} endpoint. This ensures that our audit trail reflects the actual PayPal payout-item status rather than relying exclusively on our internal database state.
2. Enforcing True Data Immutability
Application-level restrictions alone are insufficient to guarantee data integrity. We implemented database-level triggers that prevent UPDATE and DELETE operations on vendor version records, ensuring that previously verified payment records cannot be modified or removed through normal database operations.
3. Implementing Dual-Custody Enforcement
Preventing the same user from submitting and approving a request required consistent identity tracking throughout the workflow. We implemented server-side authorization checks to ensure that approval permissions cannot be bypassed or manipulated through client-side requests.
6. Accomplishments We're Proud Of
- 100 automated security tests passing: Tests cover injection attacks, race conditions, duplicate OTP replay, unauthorized approval attempts, and concurrent payment execution.
- PayPal Sandbox integration: Successfully implemented and verified payout status at the individual item level rather than relying only on batch-level confirmation.
- Immutable vendor versioning: Implemented database-level immutability with a SHA-256-based tamper-evident audit trail.
- Live deployment: Deployed VendorTrust on Render, allowing judges to interact with the complete verification workflow through a live demonstration.
Live demo: https://vendortrust-u3gg.onrender.com Source code: https://github.com/Iyyappan-15/vendortrust
7. What We Learned
- Understanding the differences between batch-level and item-level payout statuses in PayPal's Payouts API is essential when building reliable financial systems.
- Database-level immutability provides stronger protection than application-level restrictions alone.
- Dual-custody approval mechanisms used in traditional banking can be implemented effectively in modern web applications.
- Google Gemini can effectively extract structured financial information from unstructured invoice documents when combined with deterministic validation and policy enforcement.
8. What's Next for VendorTrust?
We plan to extend VendorTrust with the following capabilities:
- Production PayPal Integration: Transition from Sandbox credentials to live PayPal Payouts.
- Real-Time OTP Delivery: Integrate Twilio or SendGrid for actual email and SMS-based vendor notifications.
- Enterprise Vendor Management: Support multiple vendors with advanced role-based access control.
- Machine Learning Anomaly Detection: Identify suspicious invoice patterns and payment changes by analyzing historical vendor activity.
- ERP Integration: Introduce webhook-based integrations with QuickBooks, SAP, and Xero.
- Mobile Application: Develop a mobile interface for approver notifications and secure, one-tap dual-custody approvals.
VendorTrust – Because an invoice should never be allowed to change where your money goes without verification.