In Kenya, most online buyers would rather pay with M-Pesa than with a card. An auction or marketplace site that offers only cards loses many of them at checkout. This guide covers taking M-Pesa payments on a self-hosted BidKing or PrizeX site: how the M-Pesa add-on works, the setup, pricing in shillings, and what to check before launch.
How the M-Pesa add-on takes a payment
The M-Pesa add-on, available from Add-ons in your admin panel, uses Safaricom's STK Push: the customer gets a payment prompt on their phone and confirms it with their M-Pesa PIN. Step by step:
- The customer chooses M-Pesa at checkout. If their account has a valid Kenyan mobile number, it's used; otherwise they're asked for one. Numbers like 07…, 01…, +254… and 254… are all accepted and converted to the format Safaricom needs.
- The prompt is sent, and the page shows "Waiting for M-Pesa to confirm…". It checks every few seconds and moves on when the payment is confirmed. If the customer declines or ignores the prompt, after a few minutes it suggests what to do, and they can ask for the prompt again.
- The payment is confirmed. When Safaricom calls back, the site asks Safaricom for the payment's real status rather than trusting the callback alone. It also checks that the amount paid matches what was asked. Only then are the coins credited or the order placed.
A few details worth knowing:
- Whole shillings. M-Pesa takes whole shillings, so an amount with cents is rounded up: a KES 99.50 payment is charged KES 100. When that happens, the customer sees the rounded figure and confirms before the prompt is sent.
- One prompt at a time. Reloading the waiting page doesn't send a second prompt. The customer can ask for the prompt to be sent again if they missed it.
- Payments that get stuck. If a customer pays but the confirmation never reaches your site, the request stays pending. Use Check with gateway on Payment requests in the admin: it asks Safaricom, and settles the request if the payment matches.
Setting it up
- A Safaricom Daraja app, with Lipa Na M-Pesa Online (STK Push) enabled on your Paybill short code. The add-on sends Paybill requests, so a Till (Buy Goods) number won't work with it.
- Enter four values on the M-Pesa gateway in the admin: Consumer Key, Consumer Secret, Short Code and Passkey.
- Choose the environment. Start in sandbox, run a test payment end to end, then switch to live with your live credentials.
- The callback address is set for you. The add-on sends it with every prompt, so there's nothing to register by hand. Your site does need HTTPS and must be reachable from the internet.
Pricing in shillings
M-Pesa takes payments in Kenyan shillings only. If your store's currency isn't KES, the amount is converted to shillings using the Exchange Rates plugin's rate or a fixed rate you set on the gateway. With neither, M-Pesa is hidden at checkout.
- Currency: for prices in shillings, set your store currency to KES under Settings › Regional. Otherwise, set up a conversion rate.
- Coin price: if your site uses a coin wallet, set what one coin is worth in shillings.
- Round prices: price lots, bid steps and Buy Now in whole shillings, so nothing gets rounded up at checkout.
Mobile-first checkout
Most of your buyers will be on phones. BidKing's storefront is responsive and installs as a web app, and the STK Push flow happens entirely on the phone. Keep the M-Pesa option first in your gateway list for Kenyan buyers, and keep your checkout pages light.
Legal and practical checks
- Auctions of goods are ordinary sales. Paid-bid formats, such as penny or unique-bid auctions where every bid costs money, can fall under Kenya's betting and gaming rules. Formats like that need a license check with a local lawyer before launch. The operator is responsible for compliance.
- Personal data. Kenya's Data Protection Act applies to the customer data you hold, including phone numbers. Check whether you need to register as a data controller.
- Age. Sign-up asks for a date of birth and checks it against the minimum age set under Settings › Sign-up & compliance; it's at least 18 while auctions, prize draws, mystery boxes or games are on; raise it if your local rules require.
Common questions
Can BidKing take M-Pesa payments?
Yes, with the M-Pesa add-on, sold separately. It sends an STK Push prompt to the customer's phone and confirms the payment with Safaricom before crediting it.
Does it work with a Till number?
No. The add-on sends Paybill (CustomerPayBillOnline) requests, so you need a Paybill short code with Lipa Na M-Pesa Online enabled.
What happens to amounts with cents?
M-Pesa takes whole shillings, so the amount is rounded up, for example KES 99.50 to KES 100. The customer sees the rounded figure before the prompt is sent.
A customer paid but the order is still pending. What now?
Use Check with gateway on the payment request in the admin. It asks Safaricom about the payment, and settles the request if the payment is confirmed and the amount matches.