Inspiration
In typical B2B sales pipelines, closing a deal as "Won" creates an operational disconnect. Sales reps rarely have access to billing software, forcing them to manually copy customer details, re-enter line items into an external invoice generator, and repeatedly chase clients for payment updates.
We built KinetiQ to eliminate this friction entirely. By embedding the PayPal Invoicing API v2 directly into a multi-tenant sales CRM, sales teams can convert won opportunities into official PayPal invoices in a single click, track payment statuses in real time, and monitor incoming cash flow on an executive dashboard.
What it does
- Visual Deals Pipeline: An intuitive Kanban board tracking sales stages (Lead, Contacted, Proposal, Negotiation, Won, Lost) with quick-stage movement.
- 1-Click PayPal Sandbox Invoicing: When an opportunity is marked Won, Owners and Admins can immediately generate and send an official PayPal invoice pre-filled with customer email, deal amount, currency, and due date.
- Double-Submission Prevention: Enforces strictly one active invoice per deal to prevent duplicate billing.
- Real-Time Status Polling: Each invoiced deal includes a live details panel with direct PayPal checkout links and a "Refresh status" button that polls PayPal's API v2 to verify completed payments and record payment timestamps.
- Executive Revenue Dashboard: Features three dedicated PayPal KPI cards—Total Invoiced, Paid & Collected, and Awaiting Payment—dynamically aggregated by currency.
- Invoices Hub (/invoices/): A centralized ledger with status filters, search by recipient, and responsive mobile-friendly card views.
- Kine AI Copilot: A built-in sales assistant powered by Google Gemini (gemini-3.1-flash-lite) that uses read-only, tenant-scoped deterministic tools to query pipeline metrics, search contacts, and check invoice statuses.
- Strict Multi-Tenancy: Custom TenantModel architecture ensures complete business data separation. Business A can never view or modify Business B's data, even if URL identifiers are manually manipulated.
- Graceful Key Handling: Missing PayPal or AI keys never crash the application—the UI gracefully shows guidance to the README. ## How we built it
- Backend: Python 3.12+ and Django 5.x backed by MySQL 8 (with SQLite for fast, isolated testing).
- Payment Engine: Integrated PayPal Invoicing API v2 (Sandbox) using Python's standard library urllib for maximum resilience and zero external dependencies:
- OAuth 2.0 client credentials token caching and reuse
- Automatic invoice number generation (POST /v2/invoicing/generate-next-invoice-number)
- Draft invoice creation (POST /v2/invoicing/invoices) with DUE_ON_DATE_SPECIFIED term type
- Instant invoice dispatching (POST /v2/invoicing/invoices/{id}/send)
- Status polling (GET /v2/invoicing/invoices/{id})
- AI Engine: Google Gemini (gemini-3.1-flash-lite) integrated via native function-calling with anti-prompt injection delimiters and strict role-based scoping.
- Frontend: Bootstrap 5.3 with a Slate Navy & Indigo theme, Bootstrap Icons, and Chart.js for pipeline analytics.
- Dev & Orchestration: Docker and Docker Compose provisioning MySQL 8, automatic migrations, and seed_demo in a single command. Developed with Google Antigravity. ## Challenges we ran into
- PayPal Invoicing v2 Schema Specifics: Handling PayPal v2's strict schema requirements, including the DUE_ON_DATE_SPECIFIED payment term enum and extracting newly generated invoice IDs from HTTP 201 Created Location headers and direct href links rather than a standard JSON id property.
- Tenant Data Isolation: Ensuring that every query—from standard views to dynamic AI function calls—is strictly scoped to the authenticated user's organization.
- Hermetic Testing: Building an offline test suite of 125 automated tests that thoroughly mock external PayPal and AI network calls while accurately simulating response structures and timeouts. ## Accomplishments that we're proud of
- A seamless end-to-end workflow: Moving a deal to Won -> 1-click invoice dispatch -> PayPal Sandbox buyer checkout -> real-time status update to PAID in seconds.
- 125 passing automated tests with zero external test dependencies.
- Zero-crash architecture: Clear, friendly in-app alerts when keys are unconfigured. ## What we learned
- Deep dive into PayPal's Invoicing API v2 lifecycle, idempotent invoice generation, and status management.
- Best practices for designing secure, read-only AI agent tools within multi-tenant enterprise architectures. ## What's next for KinetiQ
- Real-time PayPal webhooks for instant push payment notifications.
- Recurring subscription billing for retainer agreements.
- Multi-currency automatic conversion and localized payment methods.
Project development commenced on October 31, 2026 (after the hackathon start date of October 1, 2026).