Ship M-Pesa payments.
Actually go live.
Daraja API integration kit for going live with TypeScript SDK, AI-ready documentation, safe callback handling, go-live playbook, and fixes for real-world Safaricom errors.
One-time payment • Choose your license • Free updates included
Why Daraja integrations break in production
Callbacks break silently
Don't count on retries. Miss a callback and payments look failed when they succeeded.
Error codes are cryptic
"resultCode: 1037" tells you nothing. The kit includes a reference table with actual fixes.
Go-live is a maze
App approval, shortcode vs till, B2C whitelisting, HTTPS requirements — the playbook covers it all.
What's in the kit
Everything you need to ship M-Pesa payments, from sandbox to production.
AI-Ready Pack
Hand this to your AI coding assistant
LLM Documentation
- • llms.txt + llms-full.txt (complete API for AI)
- • AGENTS.md integration guide
- • 14 copy-paste prompts for common tasks
Agent Rules & MCP
- • Cursor, Claude, Copilot, Windsurf rules
- • TypeScript MCP server (8 Daraja tools)
- • Docs search tool for AI agents
TypeScript SDK (Node 20+)
- • STK Push (Lipa na M-Pesa) + query
- • C2B register, validation, confirmation
- • B2C payments
- • Transaction status, balance, reversal
- • OAuth with auto-refresh and caching
- • Sandbox and production config
Safe callback handling
- • Idempotency (duplicate detection)
- • IP allowlisting (Safaricom ranges)
- • Raw callback persistence
- • Timeout and retry guidance
- • Reconciliation helper (match to orders)
GO-LIVE PLAYBOOK
- • Production app approval steps
- • Shortcode vs paybill vs till
- • B2C and B2B whitelisting
- • Callback URL requirements (HTTPS, 443)
- • Common rejection reasons
- • Go-live checklist
Storage adapters
- • In-memory (dev/testing)
- • Prisma/Postgres example
- • Pluggable interface (use your own DB)
- • Token caching
- • Callback TTL management
Framework Examples & Tools
Next.js + Express + Hono
Full examples for Next.js App Router, Express.js API, and Cloudflare Workers with D1.
Python + PHP Reference
FastAPI and Laravel reference guides following the same patterns.
OpenAPI + Tests
OpenAPI 3.1 spec, Vitest suite, error reference table with actual fixes.
See it in action
import { DarajaClient } from '@daraja-kit/core';
const client = new DarajaClient({
environment: 'production',
consumerKey: process.env.DARAJA_CONSUMER_KEY,
consumerSecret: process.env.DARAJA_CONSUMER_SECRET,
passkey: process.env.DARAJA_PASSKEY,
shortCode: '174379',
callbackUrl: 'https://yourapp.com/api/callback',
});
const result = await client.stkPush({
phoneNumber: '254712345678',
amount: 1000,
accountReference: 'ORDER_12345',
transactionDesc: 'Payment for order 12345',
});
console.log(result.checkoutRequestId);OAuth, phone normalization, password generation — all handled.
Simple, Fair Pricing
All tiers get the full kit. Choose the license that fits your use case.
Personal
For students and personal projects
License:
Personal and non-commercial use only
- Complete SDK + docs
- Go-Live Playbook
- All updates included
Pro
For serious and commercial projects
License:
Single commercial project or developer
- Everything in Personal
- Commercial use
- Use in client projects
- Priority email support
Team
For teams and organizations
License:
Team license (up to 10 developers)
- Everything in Pro
- Up to 10 developers
- Multiple projects
- Shared repository access
One-time payment • All sales final (no refunds)
Free updates included • No subscription
Read the docs and quickstart guide before purchasing
Frequently Asked Questions
Do I need my own Daraja credentials?
Yes. You need a Safaricom Daraja developer account (free). The kit uses YOUR credentials and connects directly to Safaricom — no middleman, no monthly fees.
Is this a library or full source code?
Full source code. You get repo access after purchase. Modify, extend, or integrate it into your app however you want. Commercial license included.
Can I use this in production?
Yes. Pro and Team licenses allow commercial use. Ship it in your SaaS, client projects, or internal tools. Personal license is for non-commercial use only.
Can I try before buying?
The AI documentation (llms.txt) is publicly available to review what's included. All sales are final and non-refundable.
Do I get updates?
Yes. All future updates to the kit are included. No separate fee for new features or Daraja API changes.
Can I use this with other frameworks (Express, Fastify, etc.)?
Yes. The core SDK is framework-agnostic. The Next.js app is just an example. Use the SDK with Express, Fastify, Hono, or any Node.js framework.
Ready to ship M-Pesa?
Join developers who are shipping production M-Pesa integrations with confidence.
Get Started — From KES 500One-time payment • Free updates included