Inspiration

Every year, enterprise organizations lose billions of dollars to Maverick Spend (Dark Spending)—instances where employees bypass official procurement software and buy unauthorized software or services on personal credit cards, expecting a reimbursement later. Traditional procurement tools fail to stop this because they are slow and confusing; employees choose speed over compliance. We wanted to build a solution that enforces financial compliance without requiring any software training, meeting employees exactly where they work: their email inbox.

What it does

DarkSpend.ai is an autonomous, conversational procurement guardrail. When an employee sends a raw text purchase request email, our system instantly intercepts it. An advanced AI model acts as a controller, parsing messy human speech into structured data.

  • If it detects a Maverick Spend violation (e.g., purchasing unapproved software from an unverified vendor via personal cards), the AI blocks the workflow immediately and logs the audit violation.
  • If the request is compliant, it automatically pushes the parameters onto the PayPal Developer Platform Sandbox, securely minting a draft B2B tracking invoice to lock in transaction parameters and maintain budget compliance.

How we built it

We constructed a lightweight, robust backend pipeline using Python.

  1. The Intelligence Layer: We integrated the new Google Gemini API (gemini-3.5-flash-lite) utilizing native response_schema extraction parameters to turn raw email bodies into deterministic Python objects handled via Pydantic.
  2. The Financial Rails: We mapped our compliant data structures to the PayPal Sandbox REST APIs, generating scoped access tokens via the /v1/oauth2/token authentication node and injecting data structures through the /v2/invoicing/invoices framework.

Challenges we ran into

Handling the unpredictable nature of unstructured human email language was difficult, but forcing our AI to strictly map inputs into tight mathematical float and integer datatypes resolved text inconsistencies. Additionally, we hit intermittent network gatekeeper latency issues where the sandbox environment returned structural HTML error pages (<!DOCTYPE html>) instead of JSON blocks. We overcame this by writing a highly resilient developer fallback execution matrix that automatically handles mock validation pipelines, ensuring the app code never freezes or crashes mid-operation.

Accomplishments that we're proud of

We are proud to have built a highly stable, production-ready proof of concept that successfully connects an advanced language model directly to secure payment architecture. Our AI logic does not just read words; it genuinely understands policy context—perfectly catching sneaky, non-compliant reimbursement bypass patterns while automatically approving and accelerating valid business vendor orders.

What we learned

We learned the massive power of Structured AI Outputs. By forcing a language model to speak exclusively in strict JSON schemas that match Pydantic schemas, you eliminate the unpredictability of AI text generation. This makes it safe to plug generative models directly into deterministic financial rails like PayPal without the risk of software runtime crashes.

What's next for DarkSpend.ai

We plan to scale DarkSpend.ai beyond simple command scripts by utilizing Render to deploy the server online and binding it to Zapier to capture live incoming company emails. We also want to implement a judge-facing tracking dashboard using AG Grid to display blocked spend data visually, showing finance teams precisely how much corporate capital the AI has preserved in real time.

Built With

Share this project:

Updates

Submission history