Prepaid Water Vending.
M-Pesa payments become prepaid meter tokens and SMS delivery, with retries when a vending request fails.
- M-Pesa paymentDaraja confirms the customer payment.
- Meter tokenA queued job requests the token, with retries if needed.
- SMS deliveryThe token is sent to the customer for their meter.
Water vendors were collecting prepaid payments and issuing meter tokens by hand. Customers waited, tokens went to the wrong meters, and nobody could reconcile payments against water sold.
M-Pesa in, meter token out, SMS delivered.
I built the payment-to-vending workflow using Django, Celery, PostgreSQL and React. M-Pesa Daraja confirms the payment, a worker requests the Stronpower meter token, and the customer receives it by SMS. I also implemented retries and deployment to AWS EC2 through GitHub Actions.
Every vend is a background job that retries.
M-Pesa confirmation callbacks queue a Celery task that asks Stronpower for a token and sends it by SMS. Failures retry with exponential backoff, and credentials are encrypted in the database.
Choices that made it hold up.
Retry with exponential backoff
If Stronpower or the SMS gateway is slow, the vend retries on a growing delay instead of failing.Why: a paid customer must always get a token
One meter, one customer
The system refuses to link a meter to two customers.Why: tokens were reaching the wrong meters
Encrypt vendor credentials
Stronpower and M-Pesa credentials are encrypted at rest per client.Why: many vendors share one platform
Production usage and reliability mechanisms
| Check | What it does | Result |
|---|---|---|
| Production usage | Prepaid water meters served by the platform | 115+ meters vended since January 2026 |
| Failed requests | Vending retries through background jobs | Exponential backoff implemented |
| Deployment | GitHub Actions deploys the application | AWS EC2 |
Usage alerts and leak detection from meter readings.
An engineering role or a project to build?
Share the opportunity or the problem you need solved. I usually reply within a day with questions, an approach or a time to talk.