Inspiration

In software engineering contracts and freelance development, payments face a persistent dual bottleneck:

  • Contractors routinely wait 14 to 30 days for clients to manually review pull requests and disburse milestone funds.
  • Clients hesitate to disburse upfront payments without proof that code meets acceptance criteria, passes automated test suites, and contains no security regressions.

Standard agentic finance tools often give LLMs direct spending authority, introducing serious vulnerabilities like prompt injection, hallucinated approvals, and non-idempotent duplicate transactions.

AegisPay solves this through a strict architectural division: AI advises; deterministic security policies authorize; PayPal executes.


What It Does

AegisPay is a verifiable milestone release platform connecting GitHub pull requests with autonomous PayPal payouts and AG Grid financial intelligence:

  1. Immutable Deliverable Evidence: Binds submitted Git commit SHAs, repository URLs, and statement-of-work (SOW) specification hashes to eliminate Time-of-Check to Time-of-Use (TOCTOU) substitution exploits.
  2. Two-Pass Isolated AI Evaluator: An isolated LLM auditor evaluates code diffs and test logs against acceptance criteria. A pre-pass content sanitizer neutralizes adversarial prompt-injection payloads (e.g., IGNORE ALL PREVIOUS INSTRUCTIONS) and clamps confidence scores upon anomaly detection.
  3. Deterministic Policy Firewall: The AI is purely advisory and holds zero financial authority. A deterministic policy engine enforces hard invariants (spending caps $\le \$200.00$, passing CI tests, matching evidence hashes). Low-risk deliverables enter a challenge cooling window; high-value deliverables ($> \$200.00$) route to a human-in-the-loop sign-off gate.
  4. Idempotent PayPal Payouts: Uses stable SHA-256 batch IDs (aegis-v1-${hash}) to guarantee idempotency across network retries. Payout timeouts enter an UNKNOWN state for reconciliation rather than blindly re-executing.
  5. AG Grid Financial Ledger & Portfolio Intelligence: An interactive enterprise cockpit featuring real-time quick search, dynamic pinned financial summary footers, one-click CSV export, visual cell flashing on status updates, and interactive cross-filtering by capital allocation.
  6. Verified Settlement Certificate: Generates a cryptographic, print/PDF-ready settlement certificate for confirmed payouts, linking deliverable commit SHAs directly to PayPal transaction records.

How We Built It

  • Frontend & Cockpit: Next.js 14 App Router, TypeScript, Tailwind CSS, Lucide Icons.
  • Financial Ledger: AG Grid (ag-grid-react, ag-grid-community) with ag-theme-alpine-dark, custom cell renderers, and responsive pinned summary rows.
  • Payments & Settlement: PayPal Developer Platform (OAuth2 token caching, PayPal Payouts API v1, Sandbox Webhook telemetry ingestion, transaction reconciliation).
  • AI Evaluation: OpenAI API (gpt-4o-mini) configured with strict JSON Schema output, backed by an offline deterministic fallback engine for zero-configuration judge evaluation.
  • Security & Invariants: Node.js crypto for SHA-256 evidence binding, two-pass regex token sanitizers, and integer minor units (cents) to eliminate IEEE-754 floating-point rounding errors.
  • Containerization: Docker & Docker Compose setup for instant, local judge reproduction.

Challenges We Overcame

  1. AI Confidence vs. Financial Authority: Ensuring an AI model’s confidence score (even 99%) cannot initiate money movement. We decoupled the state machine into distinct VerificationStatus, PolicyStatus, and PayoutStatus domains, placing payment execution solely behind deterministic policy gates.
  2. Prompt Injection in Source Diffs: Contractors can embed hostile directives inside docstrings or comments. Our two-pass sanitizer strips malicious instruction tokens before evaluation, penalizes security scores, and blocks release.
  3. PayPal Payout Idempotency & Timeouts: Generating stable batch hashes without dynamic retry counters to prevent duplicate payouts, and building a reconciliation flow for mid-flight gateway timeouts.

What We Learned

  • How to orchestrate the PayPal Payouts API v1 batch lifecycle and reconcile item-level status updates via webhooks.
  • How to leverage advanced AG Grid capabilities—such as cross-filtering, pinned bottom calculations, and cell flashing—to transform raw transaction data into a functional B2B operations cockpit.
  • How to safely use AI for decision support in high-stakes financial workflows without delegating execution authority.

What's Next for AegisPay

  • Multi-signature policy governance for enterprise client sign-offs.
  • Direct GitHub Actions attestation hooks to stream signed build artifacts into the evidence ledger.
  • Extending AG Grid with the AG Studio Agent Framework for natural-language financial portfolio queries.

Built With

Share this project:

Updates

Submission history