Back to all articles
Product·5 min read·

How kodiipay Uses M-Pesa B2B for Instant Landlord Payouts

Behind the scenes of kodiipay's instant rent disbursements: how the M-Pesa B2B API moves money from tenant to landlord in seconds.

K

kodiipay Team

5 March 2026 · kodiipay.co.ke

PRODUCTHow kodiipay UsesM-Pesa B2B for InstantLandlord PayoutsKkodiipay5 min read

When a tenant pays rent through kodiipay, the money needs to move from the tenant's M-Pesa wallet to the landlord's wallet or M-Pesa account — often within seconds. This is a non-trivial technical challenge in a country where the payment infrastructure was designed for person-to-person transfers, not business-to-business settlements. kodiipay solves this with Safaricom's M-Pesa B2B API.

Why B2B?

M-Pesa offers several APIs for moving money:

  • C2B (Customer to Business) — used when a tenant pays a bill via PayBill or Till
  • B2C (Business to Customer) — used to disburse money to a single recipient
  • B2B (Business to Business) — used to move money between business accounts

For kodiipay's use case, B2B is the right choice because kodiipay holds a pooled PayBill account that aggregates all incoming rent payments, then disburses to individual landlords. B2B allows kodiipay to credit multiple landlords — via PayBill (BusinessPayBill) or directly to a landlord's M-Pesa Till (BusinessBuyGoods) — in a single operation, with full reconciliation.

The Payout Flow

Here's what happens when a tenant pays rent through kodiipay:

  • Tenant initiates payment → STK Push prompts their phone
  • Tenant enters M-Pesa PIN and confirms
  • Money moves from tenant's M-Pesa to kodiipay's PayBill via C2B
  • kodiipay's backend receives the callback within 2-3 seconds
  • Payment is matched to the correct unit and tenant using the Account Reference
  • Tenant's rent schedule is updated, receipt is generated and sent
  • Landlord's kodiipay wallet is credited in real time
  • If landlord has set auto-withdraw, B2B payout fires immediately to their M-Pesa

Why It's Fast

The B2B API is designed for high-volume, low-latency transfers. kodiipay's integration uses asynchronous processing with webhook callbacks, so the tenant sees confirmation within seconds of the original STK Push, and the landlord's wallet credits within 5-10 seconds of the callback.

NOTEIdempotency
Every transaction is assigned a unique reference. If the B2B callback is delayed or duplicated, kodiipay's idempotency layer ensures the landlord is never credited twice. This is critical for financial systems where double-payouts can cause real money loss.

B2C Withdrawals

When a landlord wants to move money from their kodiipay wallet to their personal M-Pesa account, kodiipay uses the B2C API. Withdrawals are processed within 30 seconds to 2 minutes depending on Safaricom's queue. The minimum withdrawal is KES 100, and there's no maximum for verified accounts.

Reliability and Monitoring

kodiipay monitors every B2B and B2C transaction in real time:

  • Automatic retry on transient failures (network issues, timeout)
  • Alert system for any transaction stuck in pending state for more than 60 seconds
  • Daily reconciliation reports comparing kodiipay wallet balances with Safaricom statements
  • Cron-based sweep job that identifies and resolves any orphaned transactions
  • Real-time dashboard for the operations team to monitor all payment flows

The Result

All of this infrastructure work means that tenants, landlords, and property managers experience what feels like magic: tap to pay, instant confirmation, instant wallet credit, instant withdrawal. But under the hood, it's thousands of lines of code, dozens of API integrations, and a relentless focus on reliability, security, and reconciliation.

M-Pesa B2BpayoutsSafaricom APIinstant disbursementtechnical
Share this article