11 August 2026
M-Pesa Integration Guide for Landlords: How to Connect M-Pesa to StaysPal

Introduction
Managing rent payments can be time-consuming when you have to manually check M-Pesa messages, identify which tenant has paid, update invoices, and keep your records accurate.
With StaysPal, you can connect your M-Pesa account directly to your property management system and make rent collection and reconciliation much easier.
Once your M-Pesa integration is configured, tenants can pay their rent directly from the StaysPal tenant portal using M-Pesa STK Push. The payment is automatically received and matched to the tenant's invoice.
And if a tenant pays outside StaysPal — for example, directly through their M-Pesa menu — you don't need to manually recreate the payment from scratch. You simply match the payment to the relevant tenant or invoice.
This guide walks you through getting the credentials you need and setting up M-Pesa integration in StaysPal. Exactly which credentials apply depends on which Daraja API your integration uses — more on that below.
What Is M-Pesa Integration?
M-Pesa integration allows StaysPal to communicate with Safaricom's M-Pesa services so that rent payments can be processed and recorded automatically.
With M-Pesa integrated, you can:
- Allow tenants to pay rent directly from the StaysPal app tenant portal
- Send an M-Pesa STK Push to the tenant's phone
- Automatically receive payment confirmation
- Automatically reconcile payments against the correct invoice
- Keep tenant balances up to date
- Reduce manual payment entry
- Easily match payments made outside StaysPal
Safaricom provides its M-Pesa APIs through Daraja, the platform that lets applications integrate with M-Pesa services.
What You Need to Integrate M-Pesa with StaysPal
Safaricom's Daraja platform offers several different APIs — including M-Pesa Express (STK Push) and C2B (Customer to Business) — and the exact credentials you'll need depend on which one your integration uses. Most landlords using StaysPal's tenant-initiated payments will be working with the M-Pesa Express/STK Push API, but it's worth confirming with Safaricom or checking your Daraja application before assuming you need everything below.
Here's what's involved, and when each applies:
- M-Pesa Type — whether you use a PayBill or Till. Always needed.
- Short Code — your M-Pesa PayBill or Till number. Always needed.
- Consumer Key — your Daraja application's Consumer Key. Always needed — generated for any Daraja application.
- Consumer Secret — your Daraja application's Consumer Secret. Always needed — generated for any Daraja application.
- Passkey — your M-Pesa API Passkey. Only needed for M-Pesa Express/STK Push.
If your setup instead uses the C2B API — for example, to record payments made directly to your PayBill without an STK prompt — you won't need a Passkey, but you will need to register callback URLs with Safaricom. Check the current Daraja documentation for what your specific integration requires.
These credentials are entered directly into your StaysPal M-Pesa settings — tenants never see or need them. More on keeping them secure below.
Step 1: Get Your M-Pesa Business Account
Before connecting M-Pesa to StaysPal, you need an appropriate M-Pesa business payment account — either a PayBill or a Till.
If you already have a PayBill or Till that you use to collect rent, you can use those details when configuring your StaysPal integration.
If you don't yet have one, contact Safaricom to determine the most suitable option for your property.
Step 2: Create a Daraja Account
StaysPal's M-Pesa integration uses Safaricom's M-Pesa APIs through the Daraja platform.
Visit the official Safaricom Daraja Developer Portal and create an account, or sign in if you already have one.
Daraja provides the tools and documentation required to connect an application to Safaricom's M-Pesa services.
Step 3: Create Your Daraja Application
Once you have access to Daraja, create an application for your M-Pesa integration. Which credentials this generates depends on the API products you select for that application:
- Consumer Key and Consumer Secret are generated for any Daraja application, regardless of which API you use.
- A Passkey is provided specifically for the M-Pesa Express (STK Push) API — you won't get or need one if you're only using C2B or another API product.
The exact process and available API products can vary depending on your M-Pesa setup, so always refer to the current Daraja documentation when creating or configuring your application.
Step 4: Get Your Consumer Key and Consumer Secret
Your Daraja application will provide a Consumer Key and Consumer Secret.
- Consumer Key — identifies your application when it connects to the M-Pesa API.
- Consumer Secret — a confidential credential used to authenticate your application.
Together, these let StaysPal communicate securely with the M-Pesa API. Treat your Consumer Secret as confidential — never post it publicly or include it in shared documents.
Step 5: Get Your M-Pesa Passkey (If You're Using STK Push)
If your StaysPal integration uses M-Pesa Express/STK Push, you'll also need the appropriate Passkey.
The Passkey is used in the authentication process for M-Pesa Express transactions. It's what enables StaysPal to trigger an STK Push whenever a tenant chooses to pay rent through the StaysPal tenant portal.
If your integration uses a different Daraja API instead — such as C2B — you can skip this step. Check with your developer or the Daraja documentation for what's required for that API instead.
Step 6: Enter Your Credentials in StaysPal
Once you have your credentials, log in to StaysPal and open M-Pesa settings. Depending on which Daraja API your integration uses, you'll enter some or all of:
- M-Pesa Type — PayBill or Till
- Short Code — your PayBill or Till number
- Consumer Key — from your Daraja application
- Consumer Secret — from your Daraja application
- Passkey — required only for M-Pesa Express/STK Push setups
Once configured, StaysPal can communicate with M-Pesa on your behalf. Your tenants never need any of these credentials — they simply use the tenant portal to initiate payment.
How Tenants Pay Rent Through StaysPal
Once your M-Pesa integration is configured, paying rent becomes simple for your tenants:
- Tenant logs into StaysPal and views their outstanding rent or invoice.
- Tenant selects "Pay with M-Pesa."
- StaysPal initiates an STK Push to the tenant's phone.
- Tenant authorizes the payment via the M-Pesa prompt.
- M-Pesa processes the transaction through Safaricom's platform.
- StaysPal receives the payment confirmation.
- The payment is automatically reconciled — StaysPal matches it to the right tenant and invoice, and the balance updates immediately.
No manual payment entry required.
What If a Tenant Pays Outside StaysPal?
Not every tenant will use the in-app payment option — some may pay directly through their M-Pesa menu. From StaysPal's perspective, this is an offline payment: one made outside the tenant portal.
The good news: you don't have to manually recreate the transaction. Once the payment appears in your available M-Pesa transactions, simply match it to the appropriate tenant or invoice.
Online payment through StaysPal: STK Push → Payment confirmation → Automatic reconciliation → Invoice updated
Payment made outside StaysPal: Payment received → Find the transaction → Match it to the tenant/invoice → Invoice updated
Either way, your records stay accurate — reconciling an outside payment just takes one extra step.
Why M-Pesa Integration Matters for Landlords
Without integration, rent collection involves a lot of repetitive manual work:
Tenant pays → Landlord receives M-Pesa message → Landlord identifies tenant → Landlord checks invoice → Landlord records payment → Landlord updates balance
This gets harder as your number of tenants grows. With StaysPal:
Tenant pays → StaysPal receives payment → Payment is automatically matched → Invoice is updated
And for payments made outside the app:
Tenant pays → Landlord matches payment → Invoice is updated
Less manual work, fewer reconciliation errors, and cleaner financial records.
Sandbox and Production
When setting up your integration, it helps to understand the difference between these two environments:
- Sandbox — Safaricom's testing environment, used to verify your integration works before it touches live transactions.
- Production — the live environment used for actual M-Pesa transactions.
If you're working with a developer on your setup, they can test your configuration in sandbox before you switch to processing live rent payments.
Keep Your M-Pesa Credentials Secure
Your M-Pesa integration credentials are sensitive. Never share your Consumer Key, Consumer Secret, Passkey, or other API credentials with tenants or unauthorized individuals, and never publish them on websites, social media, public documents, or source-code repositories.
With StaysPal, these credentials live only in your M-Pesa integration settings — used solely to let the system communicate with M-Pesa on your behalf.
M-Pesa Integration Checklist
Before configuring M-Pesa in StaysPal, make sure you have:
- [ ] An appropriate M-Pesa PayBill or Till
- [ ] Your M-Pesa Short Code
- [ ] A Safaricom Daraja account
- [ ] A Daraja application
- [ ] Consumer Key
- [ ] Consumer Secret
- [ ] Passkey (only if using M-Pesa Express/STK Push)
Once you have these, enter them into M-Pesa settings in StaysPal.
Frequently Asked Questions
Do I need to give my M-Pesa credentials to my tenants?
No. Credentials are entered into your StaysPal M-Pesa settings only — tenants never see or need your Consumer Key, Consumer Secret, or Passkey.
Can tenants pay rent directly through StaysPal?
Yes. Tenants initiate an M-Pesa payment from their StaysPal tenant portal, and StaysPal sends an STK Push to their phone for authorization.
Are payments made through StaysPal automatically reconciled?
Yes. When a tenant pays via the integrated STK Push, the payment is automatically matched to the relevant tenant and invoice.
What happens when a tenant pays directly through M-Pesa, outside StaysPal?
You can still reconcile it in StaysPal — instead of creating the payment manually, you simply match the payment to the relevant tenant or invoice.
Do I need to be a developer to set up M-Pesa?
No. You don't need any coding knowledge — just the required Daraja credentials, entered into StaysPal's settings.
What's the difference between a Consumer Key and a Short Code?
The Consumer Key identifies your Daraja application. The Short Code identifies your M-Pesa business payment account (your PayBill or Till number).
Can I use a PayBill or a Till?
Yes. StaysPal supports both — you select which one applies when configuring the integration.
Do I need all five credentials listed in this guide?
Not necessarily. Consumer Key and Consumer Secret apply to any Daraja application, but a Passkey is specific to the M-Pesa Express/STK Push API. If your integration uses a different Daraja API — such as C2B — your setup will look different. Check with Safaricom or your developer to confirm exactly what your integration requires.
Start Collecting Rent More Easily with StaysPal
M-Pesa is already one of the most convenient ways for tenants in Kenya to pay rent. The real challenge for landlords is tracking, matching, and reconciling those payments.
StaysPal brings that process into your property management system — tenants pay via STK Push, payments reconcile automatically, and outside payments take just one extra step to match.
Not using StaysPal yet? Start your free trial or contact us to see the M-Pesa integration in action.