Inspiration
This project began as part of a larger vision.
I was building SmartSoko, an AI-powered shopping assistant to transform how people shop in Kenya using artificial intelligence. After completing the assistant and cart functionality, the next logical step was payments — and naturally, I turned to M-Pesa, Kenya’s leading provider.
But integrating M-Pesa wasn’t smooth. The APIs weren’t developer-friendly, especially for those building AI agents. Every step felt like reinventing the wheel.
Around that time, I discovered Anthropic’s Model Context Protocol (MCP) — a protocol designed to let tools interact with AI agents. At first, it didn’t click. But as I kept wrestling with converting the M-Pesa API into a usable tool, it hit me:
Every AI developer in Africa will run into this same problem — manually adapting payment APIs into formats agents can understand.
That realization shifted my focus.
Instead of solving the problem just for SmartSoko, what if I solved it for everyone?
Around that same period, I saw Perplexity AI launch Perplexity Shop and Amazon roll out their shopping assistant. These moves validated what I was doing with SmartSoko. I looked deeper into how these companies handled payments — often through AI-friendly tools like Stripe’s virtual cards.
That’s when it really sunk in: African developers didn’t have access to similar AI-compatible payment infrastructure.
So I circled back to MCP, this time with a bigger mission — to build a server that wraps payment APIs into agent-friendly tools.
I built the first version, DarajaMCP, and shared it online. It got a lot of attention. I even tagged M-Pesa on LinkedIn, hoping to spark collaboration.
But working with the M-Pesa sandbox revealed limitations: not all functionality worked, and production credentials were difficult to obtain. I started exploring other providers — Airtel, Stripe, Chipper Cash — and a new realization emerged:
This isn’t just about M-Pesa. It’s about building a modular, AI-native framework that supports all payment providers.
And that’s how PayLink was born — an open-source MCP server designed to wrap local and global payment APIs into AI-compatible tools. Built to power the next generation of intelligent agents, financial automation, and AI-driven commerce, PayLink is for developers across Africa and beyond.
What began as a personal pain point evolved into a platform — a foundation for financial access, developer productivity, and AI-first innovation in emerging markets.
What It Does
PayLink (Framework)
- A standardized, MCP-compatible server that wraps payment APIs like M-Pesa, Airtel, and Stripe.
- Enables AI agents to process payments, monitor transactions, and interact with financial systems seamlessly.
PayLink eCommerce Financial Assistant (Demo App)
- Built on top of PayLink using Perplexity’s Sonar API.
- Designed for merchants and online sellers to:
- Search for real-time competitor pricing.
- Analyze internal sales and transaction data.
- Process payments using the PayLink SDK.
- Get smart insights on pricing, inventory, and growth opportunities.
It’s like Perplexity + Mobile Money, tailored for the African context.
How I Built It
PayLink (Framework)
- Built with FastAPI.
- Implements MCP tools like
stk_pushto initiate payments. - Uses MongoDB to trace and persist transaction histories.
- Exposes a developer-friendly interface for any AI agent.
PayLink eCommerce Financial Assistant
- Integrated Sonar API for real-time web search and product insights.
- Designed to work with both LLMs that support tool use and those that don’t.
- Uses a modular architecture to allow smooth expansion to other providers.
Challenges We Ran Into
- Sonar API does not support native tool calling — I had to parse and structure results manually.
- M-Pesa sandbox unreliability and hurdles in accessing production credentials.
- Ensuring agents remain stateless yet traceable during payment sessions.
Accomplishments We’re Proud Of
- Created a functioning MCP-compatible SDK that works with and without native tool-calling LLMs.
- Abstracted mobile money systems into a plug-and-play interface for AI builders.
- Laid the foundation for financial inclusion infrastructure tailored for African developers.
What We Learned
- Africa’s fintech infrastructure is rich in potential — but still lacks standardization.
- MCP has the potential to become the bridge between agents and real-world actions.
- Designing AI agents that handle payments requires a deep focus on safety, traceability, and data flow integrity.
What’s Next
- Integrate more payment providers: Stripe, Airtel, Flutterwave, MTN MoMo.
- Add dashboards: Transaction insights, sales charts, and external market data.
- Build a WhatsApp wrapper: Empower small business owners with AI-driven financial advice — without needing a full app.
- Collaborate with African fintechs: Push for open APIs and more developer-friendly access to production environments.
Log in or sign up for Devpost to join the conversation.