-
-
Real-Time Deals Ledger: Gemini 2.5 Flash extracts contract terms, creates PayPal Sandbox invoices, and tracks live webhook settlements.
-
Physical Delivery Audit Modal: OpenCV verifies handwritten signatures and compliance checkboxes before unlocking PayPal invoice settlement.
-
Deal2Pay AI: Autonomous Deal-to-Invoice Agent & Physical Audit powered by Gemini 2.5 Flash, OpenCV computer vision, and PayPal APIs.
Inspiration
Freelancers, technical contractors, and B2B service teams lose countless hours chasing payment reconciliations and managing invoice friction. Up to 40% of payment delays stem from manual verification of field delivery acts and unstructured negotiation notes buried in chats or audio memos. We envisioned Deal2Pay AI: an autonomous Agentic Commerce pipeline where prompt negotiation, draft invoice generation, real-world physical document auditing, and final settlement happen seamlessly with zero bureaucratic drag.
What it does
Deal2Pay AI establishes a closed-loop transaction pipeline:
- Multimodal Agreement Ingestion: Listens to raw speech or informal text negotiations and uses Google Gemini to extract clients, deliverables, and financial amounts into strict schemas.
- Automated Invoicing: Programmatically drafts binding invoices using the PayPal Invoicing API v2.
- Physical Delivery Verification: An automated OpenCV vision pipeline audits scanned work orders and signed acceptance acts, verifying required checkbox completions and handwritten signature presence before unlocking billing.
- Real-Time Settlement & Ledger: Captures PayPal Webhooks (
INVOICING.INVOICE.PAID) to update an interactive, sponsor-grade AG Grid financial command console with instant, zero-latency row mutations.
How we built it
- Backend & Cloud Architecture: Built with FastAPI (Python) and deployed natively on Render Web Services. Data persistence and immutable audit logs are managed using Render Managed PostgreSQL via pooled
psycopg2connections. - Financial Infrastructure: Direct integration with PayPal Invoicing API v2 for draft invoice lifecycles and secure webhook validation for real-time payment capture.
- Frontend & Ledger Console: Developed on Next.js 14 and Tailwind CSS. We implemented AG Grid (v36) with modular registration, immutable tracking via
getRowId, and custom cell renderers for status badges. - AI & Computer Vision Engine: Google Gemini for entity extraction and prompt parsing, combined with OpenCV and
pdf2imagefor document contour thresholding and signature density verification.
Challenges we ran into
- Migrating from serverless client patterns to persistent connection pooling in Render PostgreSQL while ensuring non-blocking async endpoints in FastAPI.
- Handling modular architecture and module validation changes in AG Grid v36 to enable seamless row updates without grid re-renders.
- Calibrating OpenCV contour area detection and threshold masks to accurately distinguish between blank and checked checkboxes across varying document scan qualities.
Accomplishments that we're proud of
- Delivering a functional closed-loop Agentic Commerce application where AI validates physical work completion before triggering payment settlement.
- Flawless end-to-end integration with PayPal Sandbox Invoicing and Webhook lifecycles.
- Achieving a high-contrast, production-ready dark dashboard with instant AG Grid reactive state changes.
What we learned
We gained deep expertise in PayPal's programmatic Invoicing workflows, secure webhook signature authentication, tuning computer vision pipelines for document forensics, and scaling relational schemas on Render.
What's next for Deal2Pay AI
- Real-time mobile capture and live AR guidance for document auditing.
- Multi-currency cross-border escrow options via PayPal.
- Automated multi-agent dispute resolution based on initial deal terms and OCR logs.
Built With
- ag-grid
- fastapi
- gemini-api
- next.js
- opencv
- paypal
- postgresql
- python
- render
- tailwindcss