Inspiration

Every year, global merchants and consumers lose billions of dollars to a silent, insidious failure mode: network timeouts during checkout.

When an international cross-border payment encounters an HTTP 504 Gateway Timeout or dropped connection, ambiguity strikes:

  • The customer assumes the payment failed and clicks "Pay Again", causing catastrophic double-billing.
  • The merchant's ledger remains unconfirmed, leading to order cancellation while the customer's card has already been debited.
  • The bank initiates chargebacks, destroying merchant trust and inflating interchange fees.

We realized that in distributed financial systems, timeout is an ambiguous state, not a failure. We were inspired to build PayBridge AI — an institutional-grade financial truth and autonomous reconciliation engine that replaces manual support panics with deterministic mathematical consensus.


What It Does

PayBridge AI operates on a single foundational thesis: One payment. Two parties. One mathematically verified truth.

  1. Deterministic Safe-Action Guard (DO_NOT_REPEAT_CHECKOUT): When an upstream network timeout occurs, PayBridge immediately places a cryptographic mutex on the checkout session, strictly prohibiting duplicate payment attempts while consensus is computed.
  2. 3D Financial State Vector: Tracks three independent dimensions of financial reality simultaneously: $$\vec{S} = \begin{pmatrix} S_{\text{gateway}} \ S_{\text{app}} \ S_{\text{settlement}} \end{pmatrix}$$ Any mismatch where $S_{\text{gateway}} \neq S_{\text{app}}$ triggers an automated reconciliation cycle.
  3. Autonomous Multi-Agent DAG (A01–A10): A pipeline of 10 specialized agents ingests PayPal ground-truth capture telemetry, verifies webhook HMAC signatures, and validates raw payloads against an immutable evidence vault.
  4. Interactive Truth Gap Graph: Visualizes distributed consensus asymmetry (e.g., GAP-01: Confirmed Capture with Lost Confirmation) so merchants and buyers instantly understand what happened.
  5. Two-Lens Symmetry: Delivers synchronized portals for both buyer (confirming capture and soothing double-charge anxiety) and merchant (protecting inventory and payout schedules).
  6. Cryptographic Payment Truth Passport: Issues an immutable legal dossier sealed with a SHA-256 Merkle root hash: $$\text{Root} = \mathcal{H}(\text{Evidence}{\text{gateway}} \parallel \text{Evidence}{\text{bank}} \parallel \text{Payload}_{\text{signature}})$$ Serving as undeniable proof of payment for banks, auditors, and counterparties.

How We Built It

We designed PayBridge AI with an uncompromising architecture adhering to our non-negotiable law: AI analyzes evidence and produces claims; only authenticated human operators authorize mutations.

  • Backend (Go 1.26): High-throughput Chi router, strict timeout policies, and depguard package boundary isolation. Includes double-entry general ledger mechanics and Goose database migrations.
  • Frontend (React 18 + TypeScript + Vite): 16 specialized enterprise screens, Tailwind CSS, Lucide icons, and interactive SVG force-directed graphs for truth gap visualization.
  • Database & Security (PostgreSQL 16): Managed PostgreSQL with strict Row-Level Security (RLS) enforcement across 28 multi-tenant tables and cryptographic nonce verification.
  • Payment Gateway: Genuine integration with PayPal Developer Sandbox REST APIs (/v2/checkout/orders), leveraging idempotency keys (PayPal-Request-Id) to ensure zero repeat mutations.
  • AI Intelligence: Aegis Iris AI conversational copilot and deterministic agent orchestration with verifiable JSON schemas and prompt-injection firewalls.
  • DevOps & Cloud: One-command automated deployment engine (render.yaml Blueprints) deploying full-stack static sites, Go web services, and PostgreSQL databases to Render.

Challenges We Faced

  1. The Distributed Dual-Write Problem: Handling situations where PayPal processes a capture, but the client disconnects before receiving the HTTP 200 payload. We resolved this by building a deterministic state reducer that reconstructs ground truth strictly through read-only reconciliation queries.
  2. Cloud PostgreSQL RLS Permissions: Managed cloud databases like Render grant non-superuser database roles. Executing enterprise migrations with strict table ownership and RLS policies required engineering a self-granting role delegation mechanism in SQL.
  3. Enforcing "AI Never Moves Money": Traditional AI workflows often hallucinate actions. We enforced a strict software architectural boundary where agents can only emit immutable diagnostic claims (claim_id), and mutations require authenticated human cryptographic signatures.

What We Learned

  • Timeouts are informative states: Treating timeouts as OUTCOME-UNKNOWN rather than FAILURE prevents 99% of accidental duplicate charges in fintech.
  • Mathematical consensus builds user trust: Showing users an interactive, transparent evidence graph calms customer support panic far better than a generic spinning wheel or vague error dialog.
  • Production rigor matters: Implementing double-entry ledgers, row-level tenant security, and end-to-end sandbox validation is essential when handling financial workflows.

What's Next for PayBridge AI

  • Multi-Rail Expansion: Expanding our multi-rail connector registry to support real-time cross-settlement between PayPal, Stripe, Wise, and FedNow.
  • Instant e-FIRC & Cross-Border Compliance: Automating Foreign Inward Remittance Certificate (FIRC) generation and RBI purpose code compliance for international exports.
  • Open Banking Direct Feeds: Connecting Account Aggregator (AA) rails for instant bank-statement evidence verification.

Built With

  • artificial-intelligence
  • autonomous-agents
  • cross-border-payments
  • cryptography
  • devops
  • docker
  • double-entry-ledger
  • financial-technology
  • fintech
  • go
  • idempotency
  • microservices
  • multi-agent-systems
  • payments
  • paypal
  • postgresql
  • react
  • render
  • rest-api
  • row-level-security
  • sha-256
  • tailwind-css
  • typescript
  • vite
  • webhooks
Share this project:

Updates

Submission history