Daraja API · Concepts

M-Pesa B2C vs C2B Explained: When to Use Each

The clearest explanation of the two main M-Pesa transaction types — what they are, when to use each, and how they differ technically.

If you're building anything with M-Pesa Daraja API, you'll quickly run into the terms C2B and B2C. They sound similar but represent opposite directions of money flow. Pick the wrong one and your integration won't work.

The 30-Second Summary

  • C2B (Customer to Business): Customer pays your business. They send, you receive.
  • B2C (Business to Customer): Your business pays a customer. You send, they receive.
  • B2B (Business to Business): Bonus type. One business pays another. Both have Pay Bills.

C2B in Detail

C2B is the most common transaction type. Anytime a customer pays you via M-Pesa — for an online order, a service, a subscription, a utility bill — that's C2B.

C2B sub-types

  • Pay Bill: Customer manually enters your Pay Bill number, account reference, and amount. Old-school but still common.
  • Buy Goods (Till): Customer enters your Till Number and amount. Simpler than Pay Bill — no account reference needed.
  • STK Push (Lipa Na M-Pesa Online): Your system pushes a payment prompt to the customer's phone. They just enter their PIN. The modern way for online checkout.

For implementation, see our STK Push tutorial.

When to use C2B

  • E-commerce checkout
  • Subscription billing
  • Service fee payments (consultations, deliveries, etc.)
  • Donation collection
  • Bill payments (utilities, rent)
  • Event ticketing

B2C in Detail

B2C reverses the flow — your business sends money to a customer's M-Pesa wallet. Less common than C2B but critical for certain business models.

When to use B2C

  • Refunds: Customer paid but you can't fulfill. Refund automatically.
  • Loan disbursement: Microfinance, personal loan apps (Tala, Branch, KCB M-PESA loans use B2C internally)
  • Earnings payout: Gig economy platforms paying drivers, delivery riders, freelancers
  • Insurance claim payouts: Quick claim disbursement to claimants
  • Promotion winnings: Competition winners, loyalty rewards
  • Salary disbursement: Some Kenyan SMEs pay staff via M-Pesa B2C
  • Bank withdrawal: Customer transferring from bank app to M-Pesa

B2C requirements

  • Float in your Pay Bill: You can only send what you have. Must pre-fund the Pay Bill account.
  • Approved B2C Daraja credentials: Separate "Go Live for B2C" approval from Safaricom (1–2 weeks)
  • InitiatorName + SecurityCredential: Different from C2B credentials. Generated through Daraja portal.
  • Documented use case: Safaricom reviews your B2C use case before approving

Code: Initiating a B2C Transaction

async function b2cTransfer({ phone, amount, remarks, occasion }) {
  const token = await getAccessToken();
  const payload = {
    InitiatorName: INITIATOR_NAME,
    SecurityCredential: SECURITY_CREDENTIAL, // RSA encrypted password
    CommandID: 'BusinessPayment', // or 'SalaryPayment' or 'PromotionPayment'
    Amount: amount,
    PartyA: SHORTCODE,
    PartyB: phone,
    Remarks: remarks,
    QueueTimeOutURL: 'https://yourdomain.com/api/mpesa/b2c/timeout',
    ResultURL: 'https://yourdomain.com/api/mpesa/b2c/result',
    Occasion: occasion,
  };

  const res = await fetch(
    'https://api.safaricom.co.ke/mpesa/b2c/v3/paymentrequest',
    {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${token}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(payload),
    }
  );
  return res.json();
}

The CommandID must match the registered use case: BusinessPayment (general), SalaryPayment, or PromotionPayment. Use the wrong one and the transaction fails.

Key Differences at a Glance

AspectC2BB2C
Money directionCustomer → BusinessBusiness → Customer
User authenticationCustomer enters PINInitiator credentials (server-side)
Approval neededStandard Daraja Go LiveAdditional B2C approval
Pre-fundingNot neededRequired (you need float)
SpeedUser-paced (60s timeout)Instant (1–5s)
Common useE-commerce, billsRefunds, payouts, loans

What About B2B?

B2B (Business to Business) lets one business pay another via Pay Bills. Common use cases: supplier settlements, vendor payments, multi-business platforms (e.g., a marketplace paying merchants). Requires "Go Live for B2B" approval similar to B2C. Implementation is similar to B2C but with different command IDs and routing.

Combining C2B and B2C in One App

Most full-featured platforms need both. An e-commerce site collects payment via C2B (STK Push) and processes refunds via B2C. A loan app collects repayments via C2B and disburses loans via B2C. Plan your Daraja approvals accordingly — apply for both Go Live tracks at the start.

Frequently Asked Questions

What is M-Pesa C2B?+

C2B (Customer to Business) is when a customer pays your business — they send money from their M-Pesa wallet to your Pay Bill or Till. Examples: paying for an online order, paying utility bills, settling invoices. STK Push is the most common C2B method.

What is M-Pesa B2C?+

B2C (Business to Customer) is when your business sends money to a customer — payouts, refunds, salary disbursement, loan disbursement, prize money. Requires your business to have funds in the Pay Bill account before initiating.

Do I need separate Daraja apps for B2C and C2B?+

You can use the same Daraja app, but B2C requires additional approval ("Go Live for B2C") with documentation about why your business needs to send money to customers. C2B is enabled by default for any active Pay Bill.

What's the difference between B2B and B2C in M-Pesa?+

B2B (Business to Business) is when your business pays another business — typically supplier payments, vendor settlements. Requires both parties to have Pay Bill accounts. B2C goes to individual customer phones (M-Pesa wallets).

How long do B2C disbursements take?+

Instant in most cases — funds reach the customer's M-Pesa wallet within 1–5 seconds. They get an SMS confirmation. If their phone is off, M-Pesa holds the money and delivers when the phone comes back online.

Need help with M-Pesa integration? See our M-Pesa integration guide or get in touch.