Kikapu

Kikapu: SDLC Plan and Project Requirements

Version 0.2 (draft) · 25 Nov 2026 · Owner: Kikapu founder

Status: planning. No product code yet. Items marked [OPEN] still need a decision.


Part A: Software Development Life Cycle (SDLC)

A1. Approach

Kikapu is built by one developer with AI assistance, so the process is iterative and incremental. It runs in short cycles of about 2 weeks, each ending in something working, not a long waterfall. Each phase has a clear exit check, so time isn't wasted building on unproven assumptions.

A2. Phases

# Phase What happens Deliverables Exit check
0 Discovery and validation Visit target businesses, time the till moment, contact Safaricom Daraja support, at least one POS company and one payment partner Interview notes, list of the POS systems shops use, answers on Daraja access 10+ businesses interviewed; at least one viable way to receive payment data confirmed
1 Requirements and design Finalise this document, data model, API contracts, screen flows This document (v1.0), ER diagram, OpenAPI spec, wireframes All [OPEN] items affecting the MVP are decided
2 Foundation Repo, CI, environments, database, auth, ledger core Running skeleton on staging; ledger with tests Ledger invariants pass automated tests
3 Build: integrations Transaction engine, Daraja C2B receiver, POS partner API, partner webhook Working connectors in sandbox Sandbox payment leads to verified points end to end
4 Build: experiences Merchant dashboard, cashier tool, customer wallet (web link), SMS/WhatsApp messaging, admin console Usable screens on staging Internal walkthrough of all key flows succeeds
5 Testing and hardening Functional, fraud, load and security testing; data protection review Test report, fixed defects, runbooks All acceptance criteria (Part F) met; no open critical or high bugs
6 Pilot launch Onboard pilot businesses, train cashiers, go live Live system, onboarding kit, support process All pilot businesses live and passing the KES 10 test
7 Operate and measure Support, monitoring, weekly metrics review Weekly pilot report Six weeks of data on the success metrics (A4)
8 Review and iterate Decide whether to continue, change direction or stop; plan the next release Pilot review, roadmap v2 Decision recorded

A3. Ways of working

A4. Pilot success metrics (agreed before launch)

Metric Target
Share of sales with a customer captured 60% or more
Increase in repeat visits among enrolled customers 20% or more within 6 weeks
Share of points redeemed at least once per customer 30% or more of enrolled customers
Businesses willing to continue and pay 70% or more
Lenders expressing interest in consented trust data At least 1
"Where are my points?" complaints resolved Within 24 hours

Part B: Project scope

B1. Problem

Small Kenyan businesses have no simple way to reward repeat customers. Customers' everyday M-Pesa payments build them nothing they can use later.

B2. Product summary

Kikapu connects to a merchant's existing POS, receives each sale with the customer's phone and the M-Pesa receipt code as proof of purchase, confirms the payment with Safaricom, and automatically awards loyalty points using the merchant's reward rate. Customers use only their phone number: they install no app and carry no card. Points are redeemable only at the merchant that issued them. One Kikapu wallet shows the customer's balances across all participating merchants. Kikapu does not process payments.

B3. Pilot scope (MVP)

B4. Out of scope for the MVP

B5. Stakeholders

Stakeholder Interest
Customers Easy rewards, accurate points, privacy
Merchant owners More repeat visits, low cost, no disruption
Cashiers Fast, simple till step
POS partners Added value for their merchants, revenue share
Payment partners and Safaricom Compliant use of payment data
Kikapu (founder) Viable product, pilot learnings
Regulators (ODPC) Lawful data handling

Part C: Functional requirements

Priority: M = must have for the pilot, S = should have, C = could have.

C1. Merchant onboarding and management

ID Requirement Pri
FR-M1 A merchant can register with business name, business type, owner name, owner phone, location and Till/Paybill number. M
FR-M2 The owner's phone is verified by an SMS one-time code. M
FR-M3 A merchant chooses an integration route: POS, direct Till/Paybill, or payment partner. M
FR-M4 The system records each merchant's integration status: pending, testing, live, failed. M
FR-M5 A KES 10 test payment confirms connectivity before activation. The test transaction never earns points. M
FR-M6 Kikapu must never overwrite a merchant's existing payment-notification setup without explicit authorisation. Onboarding asks whether one exists. M
FR-M7 A merchant sets an earn rate from 1% to 5% (default 2%). Service businesses may go up to 10% [OPEN]. Changes apply only to future transactions. M
FR-M10 For M-Pesa verification, the merchant's business admin creates an M-Pesa API user in their M-Pesa business portal and authorises Kikapu to use it for transaction status checks only. Kikapu stores these credentials encrypted, never displays them, and the merchant can revoke access at any time. M
FR-M11 Onboarding is complete only when a test payment has been confirmed through a Safaricom status check. M
FR-M8 A merchant can add cashier accounts with limited permissions. S
FR-M9 A merchant can pause or leave Kikapu. Customers' existing points follow the rules in FR-L9. S

C2. Transaction ingestion (one engine for all sources)

ID Requirement Pri
FR-T1 All sources (POS partners, payment partners, Daraja callbacks, cashier tool) are turned into one standard transaction event: merchant, POS sale ID, amount, time, payment method, M-Pesa receipt code (if M-Pesa), customer phone, payment status, source, and raw data. M
FR-T2 POS partner API (primary source): authenticated with an API key per partner; each request signed (HMAC). For every completed sale the POS sends the fields in FR-T1. For M-Pesa sales the M-Pesa receipt code is mandatory as proof of purchase. M
FR-T3 The POS also sends refunds and voids, referencing the original sale ID. M
FR-T4 Payment partner webhook: same standard event, signed or verified per partner. S
FR-T5 Daraja C2B receiver (fallback): for merchants connected directly; acknowledges within Safaricom's time limit and never rejects or delays a payment (ResponseType Completed, no validation step). S
FR-T6 Duplicate prevention: each M-Pesa receipt code, and each POS sale ID per merchant, can create at most one reward, even if received several times. M
FR-T7 Discard fields not needed, especially merchant M-Pesa account balances, before storage. M
FR-T8 Store each original event and each Safaricom response unchanged for audit; never edit them. M
FR-T9 Accept events out of order (e.g. a refund before the status check completes) and settle them correctly. M
FR-T10 Handle reversals and refunds: reverse the points awarded for that transaction. M

C3. Purchase verification

ID Requirement Pri
FR-V1 Every rewarded purchase links merchant + confirmed payment + customer. The POS supplies the customer (phone) and the receipt code; Safaricom confirms the payment. M
FR-V2 Instant checks on arrival: receipt code format is valid (10 letters and numbers); code not used before; merchant active on Kikapu; amount greater than zero. Failing events are rejected and logged. M
FR-V3 Safaricom confirmation: for each M-Pesa sale, Kikapu calls the Daraja Transaction Status API using the merchant's authorised API user, and receives the result at a Kikapu result URL. M
FR-V4 A transaction is confirmed only if Safaricom's result matches the POS event: same receipt code, paid to this merchant's shortcode, same amount, status completed and not reversed, and within the claim window (7 days). M
FR-V5 Pending first: points show as pending as soon as the POS event arrives, and become spendable only after confirmation and the 24-hour pending period. Unconfirmed points are never spendable. M
FR-V6 Retries: if Safaricom times out or rate-limits, retry with increasing delays for up to 24 hours; then mark as unverified and alert the merchant and admin. M
FR-V7 Mismatch handling: if the amount, shortcode or status don't match, award no points, flag the transaction for review, and count it in the merchant's fraud score. M
FR-V8 Verification level on every transaction: Safaricom-confirmed (highest, feeds the trust profile); pending; POS-only for card or cash sales (earns points, counts less for trust); failed. M
FR-V9 Verification policy: during the pilot every M-Pesa sale is checked. The policy is configurable per merchant or partner, so that later trusted partners can be spot-checked, with full checks for new merchants and risky patterns (large amounts, many sales to one phone). S
FR-V10 If a merchant won't authorise status checks: accept POS-only M-Pesa events as partner-reported (lower trust), or use payment-partner/Daraja notifications as the proof instead. S
FR-V11 New customer confirmation: the first time a phone number appears, Kikapu sends an SMS asking the customer to confirm and consent. Points stay held until confirmed. M
FR-V12 Backup when the cashier forgot the phone: the customer can forward the M-Pesa SMS to Kikapu's WhatsApp/SMS number within 7 days; it's matched to the POS sale by receipt code. C

C4. Points and ledger

ID Requirement Pri
FR-L1 Points = confirmed amount × merchant earn rate; 1 point = KES 1 discount at the issuing merchant only. M
FR-L2 Points are stored to 2 decimal places internally and shown as whole points. M
FR-L3 Newly earned points are pending for 24 hours before they can be spent. M
FR-L4 Ledger is double-entry and append-only: every change is a new entry with a reason and a reference; corrections are new entries. M
FR-L5 Balances are kept per customer per merchant. M
FR-L6 Each point issued uses one point credit from the merchant's balance; with no credits left, no points are issued and the merchant is alerted. M
FR-L7 Points expire 12 months after earning; the oldest points are used first. M
FR-L8 Limits: a maximum number of points per transaction, and a maximum of rewarded transactions per customer per merchant per day (default 3). M
FR-L9 If a merchant leaves, its customers' points remain viewable but can't be spent; customers are told in advance. [OPEN: notice period] S
FR-L10 Optional welcome bonus for a customer's first purchase at a merchant, paid for by the merchant. C
FR-L11 Visit-based rewards for salons (e.g. 5th visit, 20% off). [OPEN: MVP or later] C

C5. Redemption

ID Requirement Pri
FR-R1 Customers can spend points only at the merchant that issued them. M
FR-R2 Minimum 50 points per redemption; points can cover at most 50% of the bill. M
FR-R3 Redemption needs the customer's confirmation, e.g. the cashier enters the phone and amount, and the customer receives a one-time code by SMS to give to the cashier. [OPEN: final flow] M
FR-R4 Each redemption creates a ledger entry and appears in the merchant's report. M
FR-R5 A redemption can be cancelled within the same day, which restores the points. S

C6. Point credits (merchant billing)

ID Requirement Pri
FR-B1 Merchants buy point credits through a Kikapu Paybill or payment partner; credits are added automatically when the payment is confirmed. M
FR-B2 Price per credit can be configured (starting assumption KES 0.10). [OPEN: free during pilot?] M
FR-B3 Low-balance alerts at 20% and 5% remaining, by SMS/WhatsApp and in the dashboard. M
FR-B4 At zero credits, earning pauses at that merchant; customers are told rewards are paused; existing points stay valid. M
FR-B5 Merchants can download receipts or statements for credits bought. S

C7. Customer experience

ID Requirement Pri
FR-C1 No app download: customers identify themselves by phone number. M
FR-C2 After a rewarded purchase, the customer is notified (SMS or WhatsApp) with points earned and that merchant's balance. [OPEN: per purchase vs summary, to control SMS cost] M
FR-C3 A web wallet reached through a secure link (phone + one-time code) shows balances per merchant, history and expiry dates. M
FR-C4 Customers can check balances by sending a keyword (e.g. "POINTS") by SMS or WhatsApp. S
FR-C5 Customers can opt out and ask for their data to be deleted. M
FR-C6 English and Swahili message templates. S

C8. Merchant dashboard

ID Requirement Pri
FR-D1 Overview: credits left, points issued, points redeemed, points outstanding. M
FR-D2 Customer list (phone partly hidden by default), number of visits, last visit. M
FR-D3 Repeat-visit analytics: returning customers, visit frequency before and after Kikapu. S
FR-D4 List of customers who stopped coming, e.g. no visit in 30 days. C
FR-D5 Cashier tool (mobile-friendly web) for shops without POS redemption support: start redemptions, look up a customer's points. M

C9. Admin and support

ID Requirement Pri
FR-A1 Look up any transaction, customer or merchant and see its full ledger history. M
FR-A2 Make manual adjustments only as correcting entries, with a reason and the admin's name. M
FR-A3 Fraud alerts: sudden spikes, repeated small amounts, the same phone at many transactions, cashier patterns. S
FR-A4 Monitor each merchant's integration health; alert if no events arrive for 48 hours during trading. M
FR-A5 Pilot metrics dashboard (Part A4). S

Part D: Non-functional requirements

ID Area Requirement
NFR-1 Availability A Kikapu outage must never block a merchant's sale or payment. Notifications received while degraded are queued and processed later.
NFR-2 Reliability No payment notification is lost: store first, then process. Every processing step can safely run twice.
NFR-3 Performance Callback acknowledged in under 2 s; pending points visible within 1 minute of the POS event; 95% of Safaricom confirmations completed within 1 hour; cashier tool actions under 2 s on 3G.
NFR-4 Accuracy Ledger invariants checked automatically every day: credits used = points issued; no negative balances except clawbacks; every entry has a source.
NFR-5 Security TLS everywhere; secrets in a secret manager; merchant M-Pesa API credentials encrypted, used only for status checks, never logged; Safaricom IP allowlist and secret URL token on callback and result URLs; signed partner webhooks; role-based access; audit log of admin actions.
NFR-6 Privacy Collect the minimum: no purchase items, no ID numbers, no merchant M-Pesa balances. Encrypt phone numbers at rest; hash them for analytics. Retention: 24 months after last activity [OPEN].
NFR-7 Compliance ODPC registration, privacy policy, consent records per customer, data-subject requests handled within legal timelines, any data sent outside Kenya declared.
NFR-8 Scalability (pilot) 50 merchants, 10,000 customers, 2,000 transactions/day without redesign.
NFR-9 Observability Structured logs, error alerts, uptime checks on callback endpoints.
NFR-10 Usability Cashier step takes 3 seconds or less; customer messages are short, in plain English or Swahili.
NFR-11 Cost SMS cost per active customer tracked monthly and kept below the revenue per customer.
NFR-12 Maintainability TypeScript throughout, automated tests on the ledger and transaction engine, documented API contracts.

Part E: Technical design summary

E1. Proposed stack (solo-friendly)

E2. Core data entities

Merchant · MerchantUser · Integration · MpesaApiCredential (encrypted) · Customer · ConsentRecord · TransactionEvent (raw, never edited) · Transaction (normalised) · VerificationAttempt (status check request + Safaricom result) · LedgerEntry · PointLot (for expiry) · CreditPurchase · Redemption · Notification · AuditLog

E3. Main flows to document as sequence diagrams

  1. POS sale with receipt code → instant checks → pending points → Safaricom status check → confirmed → spendable after 24 h → notification
  2. Status check failure → retries → unverified → alert
  3. Merchant onboarding → POS connection → M-Pesa API user authorised → KES 10 test confirmed by Safaricom → live
  4. Credit purchase → confirmation → credits added
  5. Redemption → customer code → ledger entry
  6. Reversal → points clawed back
  7. New customer → confirmation and consent → points released

Part F: Acceptance criteria (pilot release)

  1. A POS sale with a customer phone produces the correct points, exactly once, even if sent three times.
  2. A POS M-Pesa sale earns spendable points only after Safaricom confirms the same code, shortcode and amount. A mismatched amount or another merchant's code earns nothing and is flagged.
  3. The KES 10 onboarding payment earns no points.
  4. A transaction from an unknown or inactive merchant earns no points and is logged.
  5. A reversal removes the points awarded for it; the ledger still balances.
  6. A merchant with zero credits issues no points, gets an alert, and its customers see "rewards paused".
  7. A customer cannot spend points at another merchant, below 50 points, or above 50% of a bill.
  8. Points expire after 12 months, oldest first.
  9. A new phone number receives a confirmation SMS; points stay held until confirmed.
  10. If Kikapu's API is down, merchant payments still complete; queued notifications are processed after recovery with no loss.
  11. A merchant's M-Pesa balance never appears in the database or logs.
  12. Every balance shown to a customer or merchant can be explained from ledger entries.
  13. If Safaricom's status check fails repeatedly, points stay pending, then become unverified, and the merchant and admin are alerted.

Part G: Risks and dependencies

Risk or dependency Impact Mitigation
Daraja access for many merchants' shortcodes is slow or not allowed No Till route Ask Daraja support early; use a payment partner; prioritise POS partners
Merchants' notifications already go to another system Can't connect directly Not needed: verification uses status checks on the POS-supplied code (FR-V3)
Merchants won't create or share an M-Pesa API user for status checks Can't confirm with Safaricom Explain read-only use; revocable access; fall back to partner-reported trust level (FR-V10)
Safaricom rate limits or downtime on status checks Verification delays Async retries within the 24 h pending window (FR-V6); spot-checking at scale (FR-V9)
No POS partner signs up Primary route unavailable Till route plus cashier tool for the pilot
Cashiers skip capturing customers No data 3-second design, phone captured by the POS M-Pesa prompt, cashier incentives, SMS-forward backup (FR-V12)
Rewards feel too small Low engagement Focus on higher-value, frequent businesses; welcome bonus; visit rewards
SMS costs exceed revenue Unsustainable Summary messages, WhatsApp, balance on request
Solo developer capacity Delays Strict MVP scope, AI assistance, reuse managed services
Data protection non-compliance Fines, loss of trust ODPC registration, consent, minimum data, legal review

Part H: Proposed timeline (solo, AI-assisted)

Weeks Phase
1–3 Phase 0: discovery and validation (interviews, Daraja, POS and partner conversations)
4 Phase 1: requirements v1.0 and design
5–6 Phase 2: foundation and ledger
7–9 Phase 3: integrations
10–12 Phase 4: dashboards, cashier tool, wallet, messaging
13–14 Phase 5: testing and hardening
15 Phase 6: pilot launch
16–21 Phase 7: operate and measure (6 weeks)
22 Phase 8: review and decide

Estimates assume part of each week goes to selling and onboarding, not only coding. Adjust once Phase 0 answers the Daraja and POS questions.


Part I: Open decisions

  1. Pilot neighbourhood and final business mix
  2. How customers spend points at the till (FR-R3)
  3. Whether the SMS-forward backup is in the MVP (FR-V12)
  4. Notify after every purchase, or send summaries (FR-C2)
  5. Pilot pricing: free credits or KES 0.10/point (FR-B2)
  6. A higher earn-rate cap and visit rewards for salons (FR-M7, FR-L11)
  7. Notice period when a merchant leaves (FR-L9)
  8. Data retention period (NFR-6)
  9. Backend framework and database hosting region (E1)
  10. Exact Daraja Transaction Status API access for third-party platforms: confirm with Safaricom (FR-V3)