Inspiration

In 2023, I tried to book a flight for my mother from Lagos to Gombe. The payment went out — but then it just hung. Nobody could tell me where it was stuck: the merchant agent, PalmPay, Air Peace, and Fidelity Bank's payment gateway all pointed elsewhere, and there was no single source of truth to check against. What should have taken minutes turned into hours of calls and follow-ups just to confirm whether the money had actually moved.

That experience stuck with me. In emerging markets and fast-growing payment ecosystems like Paystack, direct bank transfers and POS payments frequently arrive without clean invoice references in the metadata. Finance and operations teams spend countless hours manually cross-referencing payer names, currency discrepancies (kobo vs Naira), and chasing customers via phone calls or messaging apps — doing exactly what I did that day, just at a larger scale. I built PayBridge to eliminate this operational bottleneck completely with an autonomous background Taskmaster agent, so no one has to manually chase a payment across four systems to find out what happened to it.

What it does

PayBridge implements an intelligent 3-Tier Taskmaster architecture:

  1. Tier 1: Deterministic Pre-Filter ($0 cost) — Matches exact references and amounts instantly without spending LLM tokens.
  2. Tier 2: Gemini 3.5 Flash Reasoning Engine — Evaluates ambiguous payments (fuzzy names, mismatched email domains, currency unit conversions) and outputs structured match confidence and detailed rationale.
  3. Tier 3: Autonomous WhatsApp Human-in-the-Loop Resolution — If confidence is low, PayBridge automatically dispatches an interactive WhatsApp outreach message via Twilio. When the customer replies with their invoice reference, an inbound webhook verifies the reply, updates the ledger to paid, and sends an instant WhatsApp receipt.

How I built it

  • AI Model: Gemini 3.5 Flash (via google-genai SDK / Google AI Studio) with strict JSON schema outputs.
  • Agent Architecture: Google ADK / Agentic workflow pattern with deterministic pre-filtering.
  • Backend & Webhooks: FastAPI web service with interactive Swagger UI and Google Cloud Functions / Cloud Run compatibility.
  • Messaging & Integrations: Twilio WhatsApp Content Templates & Paystack API.
  • Infrastructure: Terraform IaC for Cloud Run, Cloud Scheduler, and Cloud Firestore.

Challenges I ran into

  • Currency Normalization: Handling Paystack minor units (kobo) vs major units (Naira) while ensuring Gemini correctly understands numeric scale without hallucinating values.
  • Asynchronous State Management: Decoupling the webhook receiver so customer WhatsApp replies arriving hours later seamlessly match back to the original pending transaction.

Accomplishments that I'm proud of

  • Building a truly autonomous agent that performs multi-step actions (decision → notification → webhook parsing → ledger reconciliation) rather than just a conversational chatbot.
  • A token-efficient architecture that resolves the majority of ambiguous real-world payment data without ever escalating to a human.

What I learned

  • How to design a cost-aware agent architecture — deferring to a $0 deterministic pass before ever calling an LLM taught me to think about AI agents in terms of "when not to reason," not just when to.
  • Structured JSON schema outputs from Gemini made the reasoning tier dramatically more reliable than free-form text — validating and constraining the model's output format upfront cut down on downstream parsing errors significantly.
  • Designing for asynchronous human response time (a customer might reply to WhatsApp minutes or hours later) forced me to think about agent state persistence differently than a typical synchronous chatbot flow.

What's next for PayBridge

  • Multi-channel escalation: extend Tier 3 beyond WhatsApp to SMS and email fallback for customers without WhatsApp access.
  • Multi-currency support: extend the normalization logic beyond Naira/kobo to other African currencies (Cedis/pesewas, Shillings/cents) for broader Paystack market coverage.
  • Self-improving confidence thresholds: use historical resolution outcomes to automatically tune the 0.85 confidence cutoff per merchant, rather than a fixed global threshold.
  • Merchant dashboard: a lightweight UI for finance teams to review Gemini's reasoning trail on edge cases, rather than only interacting via WhatsApp escalations.

Built With

  • agentic-ai
  • anti-gravity-cli
  • fastapi
  • financial-reconciliation
  • gemini-3-5
  • google-ai-studio
  • google-cloud
  • hackathon
  • paystack
  • taskmaster
  • whatsapp
  • youtube-studio
Share this project:

Updates

Submission history