M-Pesa B2C

How to initiate and approve M-Pesa B2C transactions

M-Pesa B2C are ideal for payment disbursement to M-Pesa accounts. M-Pesa B2C is normally used for salary and promotional payments, remittance termination, and even business payouts if the beneficiary prefer to be paid direct to their M-Pesa phone number accounts rather than Till/PayBill numbers.

Linke other send money transactions, the M-Pesa B2C is a two step process. The first step is to initiate the transaction and the second one is to approve the transactions. Both the initiate and the approval are automated with the API.

The payload contains transactions field which is of type array. This means you can send money to many beneficiaries in a single request.

M-Pesa B2C Transaction Fields

The following fields must be specified in your transaction item

nameName of the beneficiary
accountBeneficiary phone number. Must be prefixed with the country code e.g 254....
amountAmount to send in KES
narrativePurpose of payment

Step 1: Initiate M-Pesa B2C

To begin, please go through the Introduction to obtain the API Keys, Device ID and everything else you need to proceed.

Once setup we recommend using the SDKs provided by IntaSend to make it easy for you to sign and approve with less efforts. We have done the heavy lifting for you, so do not reinvent the wheel if the SDK of your stack is already available.

from intasend import APIService

service = APIService(token=token, private_key=private_key)

transactions = [{'name': 'Awesome Customer 1', 'account': 25472.., 'amount': 10},
                {'name': 'Awesome Customer 2', 'account': 25472.., 'amount': 10000}]

response = service.transfer.mpesa(device_id=<DEVICE-ID>, currency='KES', transactions=transactions)
use IntaSend\IntaSendPHP\Transfer;

$transactions = [

$transfer = new Transfer();

$response=$transfer->mpesa('<DEVICE-ID>', "KES", $transactions);
const IntaSend = require('intasend-node');

const intasend = new IntaSend(/*...Authenticate*/)

let payouts = intasend.payouts();

     device_id: '<DEVICE-ID>', 
     currency: 'KES', 
       name: 'Joe Doe',
       account: '25472....',
       amount: '10',
       narrative: 'Reason for payment'
   .then((resp) => {
     console.log(`Payouts response: ${resp}`);
     // Approve payouts method can be called here if you would
     // like to auto-approve immediately
   .catch((err) => {
     console.error(`Payouts error: ${err}`);

Step 2: Approve and release payment

Response from Step 1 is passed to the approve function. The approve function signs the nonce as the Nonce and Encryption Signatures guidelines.

approved_response = service.transfer.approve(response)
$response = $transfer->approve($response);
    .approve(resp, false)
    .then((resp) => {
        console.log(`Payouts approve: ${resp}`);
    .catch((err) => {
        console.error(`Payouts approve error: ${err}`);