Skip to content

PesaKit for M-Pesa on Node.js

The practical toolkit for STK Push, Dynamic QR, C2B, B2C, pull-based reconciliation, status checks, reversals, and callback-heavy Daraja integrations.
  • Build against Safaricom Daraja from a Node.js backend without carrying your own auth, request-shaping, and callback-parsing plumbing.
  • Keep integrations explicit and maintainable with typed inputs, typed responses, and fast-fail validation at the SDK boundary.
  • Move faster across common M-Pesa payment and operational flows with one consistent Mpesa client from PesaKit.
  • Mpesa as a single entry point for the implemented API families.
  • Automatic OAuth token fetching with in-memory caching and concurrent refresh deduplication.
  • Typed SDK errors for auth, request, validation, and callback parsing failures.
  • Optional callback parsers and a standalone HTTP callback handler for STK, C2B, and async result routes.
  • Pull-based reconciliation support for recent C2B transaction recovery.
  • A docs set that covers setup, local testing, sandbox credentials, go-live preparation, and common troubleshooting.
  • Use it in Node services, Express or Fastify apps, workers, queue consumers, or other backend processes that need to talk to Daraja.
  • Keep credential sourcing flexible with constructor config and environment-variable fallback.
  • Stay close to Daraja behavior while avoiding repetitive payload assembly across flows.
  1. Read the quick start.
  2. Configure your environment and credentials.
  3. Confirm the Node runtime expectations.
  4. Follow the end-to-end STK payment flow if you are integrating your first checkout. 5. Pick the guide for your first flow: STK Push, Dynamic QR, C2B, Pull Transactions, or B2C.

This SDK is aimed at the M-Pesa flows most Node teams need in normal product and operations work. Daraja APIs that mainly serve special onboarding programs, commercial agreements, or narrower enterprise workflows are tracked in the API coverage matrix but intentionally kept out of the core SDK surface.

This SDK focuses on the commonly used Daraja payment and operational APIs. The current implementation surface and known gaps are tracked in the API coverage matrix.

Landela Tech specializes in payment integrations across local and international providers, building practical infrastructure for teams shipping real-world payment flows.

Learn more at landelatech.com.