Official Node.js SDK Now Available via NPM

The Developer-First
M-Pesa Gateway.

Integrate STK Pushes and automated B2C withdrawals into your app in minutes using the syncpesa-connect SDK. One flat 2.8% fee. Zero Safaricom paperwork.

Bank-Grade Security
<200ms Latency
Auto-Reconciliation
0

API Calls Processed

0

Active Developers

0

KES Volume Settled

99.99

% Uptime SLA

Infrastructure

Engineered for Fintech Scale.

We abstract away the complexities of Daraja, SSL certificates, and network timeouts so you can focus on building your product.

Official NPM SDK

No more raw fetch requests or messy headers. Install syncpesa-connect and initialize payments in exactly 3 lines of Javascript.

Flat 2.8% Pricing

Zero setup fees. Zero monthly hosting fees. We take a flat 2.8% cut at the gateway level to cover carrier costs, passing the remaining liquidity directly to you.

Idempotent Safety

Network glitch? Pass an idempotencyKey in your payload. Our state machine ensures a user is never double-charged, even if they hit the pay button twice.

Real-Time Webhooks

Receive instant JSON payloads when a transaction settles. Every webhook is cryptographically signed with HMAC-SHA256 so you can verify its authenticity.

Status Polling

Don't want to deal with Webhooks? Use our built-in getTransactionStatus() method to poll the server securely and verify if a payment succeeded.

Auto-Sweep B2C

Enable Auto-Sweep in your developer dashboard to have net API funds automatically forwarded to your designated M-Pesa number instantly.

Integration Guide

Initialize in 3 Lines of Code.

We provide a fully typed, promise-based Node.js SDK. No more manual header formatting or complex REST wrappers.

1. Install the SDK

npm install syncpesa-connect

2 Trigger a Payment

Initialize the client with your live or test key. Call `initiateCheckout` to immediately trigger a Safaricom STK push on the user's phone.

checkout.js
const SyncPesaConnect = require('syncpesa-connect');

// Initialize the client
const syncpesa = new SyncPesaConnect('sp_live_YOUR_API_KEY', 'production');

async function chargeUser() {
  try {
    const response = await syncpesa.initiateCheckout({
      amount: 1500,
      phone: '254712345678',
      externalReference: 'ORDER-90210'
    });
    
    console.log('Prompt Sent!', response.data.checkoutRequestId);
    return response.data.checkoutRequestId;
  } catch (error) {
    console.error(error.message);
  }
}

3 Verify the Status

You don't need a webhook server. Simply pass the checkoutRequestId returned from step 2 to check if the user entered their PIN successfully.

verify.js
async function verifyPayment(checkoutId) {
  try {
    const status = await syncpesa.getTransactionStatus(checkoutId);
    
    if (status.data.status === 'SUCCESS') {
      console.log('Payment Secured! Receipt:', status.data.receipt_code);
      console.log('Net amount earned:', status.data.net_amount);
    } else if (status.data.status === 'FAILED') {
      console.log('User cancelled the prompt or entered wrong PIN.');
    } else {
      console.log('Still pending. Check again in 2 seconds...');
    }
  } catch (error) {
    console.error('Verification failed:', error.message);
  }
}

Live API Console

Send a test STK push directly from your browser right now.

Demo mode uses sandbox environment. No actual funds are deducted.

Transparent Pricing

No hidden Safaricom tariff math. Just one flat percentage.

Gateway Provider Transaction Fee Native M-Pesa Instant B2C Payouts
SyncPesa Connect
2.8% Flat
Stripe / Global Cards 2.9% + KES 30
Flutterwave 2.9% + KES 30
Direct Daraja (Safaricom) Complex Tiers + KES 30k Setup

On a KES 5,000 payment, you save exactly KES 35.00 per transaction compared to Stripe.

App-Only Provisioning

To prevent credential scraping and unauthorized gateway access, SyncPesa Connect API keys cannot be generated on the web. You must download the official SyncPesa mobile application, complete identity verification, and provision keys securely from the Developer Portal.

API Limitations & Rules

  • B2C Withdrawals (to mobile numbers) are fully active.
  • B2B API Withdrawals (to paybills) are currently disabled.
  • Maximum transaction limit is KES 250,000 per request.
  • API Keys auto-expire after 90 days. Auto-renewal alerts are sent via email.

Frequently Asked Questions

Do you have an NPM package?

Yes! Our official SDK is available on NPM. Simply run npm install syncpesa-connect. It handles authentication, STK pushes, balance checking, and B2C withdrawals with fully typed promises.

What is the 2.8% fee covering?

The flat 2.8% fee covers Safaricom carrier charges (which vary wildly), our server infrastructure, security monitoring, webhook delivery, and 24/7 uptime maintenance. There are no hidden setup fees or monthly subscriptions.

How long does settlement take?

If you enable Auto-Sweep in your Developer Dashboard, net funds are B2C transferred to your registered M-Pesa number the absolute second the STK push succeeds. If manual, you can withdraw anytime via the API or App.

Is there a test/sandbox environment?

Yes! We provide test API keys (sp_test_xxx) that connect directly to our sandbox routing engine. You can safely build and test your integration before going live.

Start Building Today.

Download the SyncPesa app to verify your identity, access the Developer Portal, and generate your production API keys.