Payroll on USSD: How It Works
A technical but accessible look at how we built payroll that works on any phone. No smartphone required, no app downloads, just dial and go.
When we tell people Kazisafi runs on USSD, we usually get one of two reactions: confusion or skepticism. “USSD? Isn’t that outdated?” or “How can payroll work on a feature phone?”
Let me explain.
What is USSD?
USSD (Unstructured Supplementary Service Data) is the technology behind those *XXX# codes you dial on your phone. When you check your M-Pesa balance with *334#, that’s USSD. When you buy airtime with *544#, that’s USSD too.
It’s been around since the 1990s, works on every phone ever made (yes, even that Nokia 3310), and doesn’t require internet connectivity. The message travels through the cellular network directly to our servers.
Why USSD for Payroll?
Here’s the reality of Kenyan businesses:
- 95% have between 5-50 employees
- Many employees work in locations with poor internet
- Not everyone has a smartphone
- App downloads are a friction point
A security guard in Kisumu shouldn’t need to download an app to check their payslip. A hotel cleaner in Mombasa shouldn’t need WiFi to request leave.
How Our USSD Flow Works
When an employee dials our USSD code, here’s what happens:
- Authentication: They enter their employee ID and PIN
- Menu Selection: They choose what they want to do
- Action: View payslip, request leave, check attendance
- Confirmation: They get instant feedback
The entire interaction takes less than 30 seconds.
The Technical Challenge
Building payroll on USSD isn’t straightforward. USSD sessions timeout after 180 seconds, messages are limited to 182 characters, and the connection is stateless.
We solved this by:
- Caching session state in Redis with automatic expiry
- Compressing information into readable, short messages
- Building a state machine that handles navigation gracefully
The result? An employee can check their payslip in three taps.
What Employees Can Do via USSD
- View current and past payslips
- Check leave balance
- Request leave
- Update personal details
- Report issues
All without internet. All on any phone.
The Web Dashboard
While employees use USSD, employers get a full web dashboard. This is where the heavy lifting happens:
- Run payroll with automatic tax calculations
- Process bulk M-Pesa payments
- Manage employee records
- Generate compliance reports
- Handle leave approvals
The dashboard is modern, fast, and mobile-responsive. But it’s not required for employees to interact with the system.
Why This Matters
Financial inclusion isn’t just about bank accounts. It’s about access to systems that were previously gatekept by technology requirements.
When we say “payroll that works on any phone,” we mean it literally. The grandmother running a small shop can pay her two employees properly. The construction foreman can track attendance for his crew. The hotel manager can process leave requests from anywhere.
That’s the future we’re building.