UniFi hotspot with M-Pesa payments
· 3 min read
UniFi can hold guests on a portal page until they are let on, but its built-in payment options are card processors, not M-Pesa. To sell by M-Pesa you point the site's guest portal at an external page that takes the payment, and that service tells the controller to authorise the phone for the bundle it bought. No voucher to type, and nothing installed on the controller.
What UniFi gives you out of the box
A UniFi site has a hotspot (guest) portal: guests who join the guest network are held on a page until they are authorised. UniFi can authorise them with printed vouchers, a password, or a handful of card payment providers. For a Kenyan WiFi business that leaves a gap. Customers pay by M-Pesa, and printed vouchers mean someone has to sell them by hand.
How M-Pesa fits a UniFi site
UniFi lets the guest portal send guests to an external page instead of its own. That page takes the payment and then uses the controller's API to authorise the guest's device. A purchase goes like this:
- The customer joins your guest WiFi and the portal page opens on their phone.
- They choose a bundle and approve the M-Pesa prompt with their PIN.
- The payment is confirmed with M-Pesa and matched to the order.
- The controller is told to authorise that phone on the site, for the time and speed of the bundle.
- The receipt arrives by SMS. There is no code to type in.
Two controller settings make it work: the guest portal pointed at the external page, and the payment page's addresses allowed before sign-in (UniFi's pre-authorisation list), so a guest can reach the page before they have paid.
Which UniFi setups work
- UniFi Network on a cloud or self-hosted server.
- UniFi OS consoles such as the Cloud Gateway and Dream Machine.
- Several sites on one controller: each site is its own location with its own bundles and prices.
The billing service has to reach your controller over HTTPS from the internet, using a local admin account. Create one just for this and limit it to the sites you sell on. With PAY N BROWSE that password is stored encrypted and used only when we talk to the controller.
Speed limits per bundle
When a guest is authorised, the authorisation can carry upload and download limits as well as the time. Use them: a guest network shared by a busy café or a hostel needs per-person limits, or one download makes the WiFi useless for everyone else in the evening.
Moving an existing UniFi site across without disruption
If a site already sells printed UniFi vouchers, you do not need a hard cut-over. Add the site, let the existing voucher tiers be read in, set your M-Pesa bundles, and only then switch the guest portal to the payment page, on the day you choose. Vouchers already sold keep working until they run out.
What to check before going live
- Join the guest network on a phone and confirm the payment page opens by itself.
- Buy the cheapest bundle with your own M-Pesa and confirm the phone gets online.
- Check the bundle's speed limit with a speed test.
- Put your support number on the page, so customers with a problem can reach you.
Add a UniFi site and sell by M-Pesa. Nothing is installed on your controller.
Connect your UniFiQuestions people ask
Does UniFi support M-Pesa?
Not natively. UniFi's guest portal supports vouchers and some card providers. M-Pesa works by pointing the guest portal at an external payment page that authorises the guest through the controller's API after payment.
Do UniFi customers get a voucher code?
They do not need one. After M-Pesa confirms, the phone is authorised on the site for the bundle's time and speed, and the receipt is sent by SMS.
Do you need SSH or files on my UniFi controller?
No. Everything goes through the controller's own API with a local admin account you create; your other guest portal settings are left as they are.
Keep reading
MikroTik hotspot with M-Pesa payments: how it works
How a MikroTik hotspot takes M-Pesa payments: the captive portal, the walled garden, STK push, vouchers and what happens when a payment goes wrong.
How to start a WiFi hotspot business in Kenya
A practical guide to selling WiFi in Kenya: the internet connection, the router, M-Pesa payments, pricing your bundles and keeping customers online.