- Customer
- Rail
- Gateway
- Merchant ledger
Understanding Payment Gateways and Rails in Kenya
A payment gateway handles the merchant-facing part of a payment. It creates a checkout or payment request, passes information to the appropriate processor or payment service and returns a result that the merchant can attach to an order. Methods vary by gateway and merchant account.
Payment rails refer to the actual networks and protocols that move money between accounts. In Kenya, the main rails are mobile money platforms, card networks (Visa, Mastercard), and interbank systems. Gateways use these rails to process payments but also provide APIs and dashboards for businesses to manage online payments, payouts, and reconciliation.
Core Payment Methods in Kenya
M-Pesa: STK Push, PayBill, and Till
Kenyan businesses can collect through several M-Pesa flows. The differences matter when you attach a payment to an order:
- STK Push: Initiates a payment by sending a prompt to the customer’s mobile phone, asking them to enter their PIN to approve the transaction. This is commonly used for online payment and e-commerce checkout. Integration is done via the Safaricom Daraja API.
- PayBill: A customer enters the business’s PayBill number and an account reference. The reference can help the merchant match a receipt to a bill.
- Till Number (Lipa na M-Pesa Buy Goods): Customers pay to a Buy Goods Till, such as a number displayed at a retail checkout.
M-Pesa APIs enable businesses to automate payment collection, receive asynchronous payment confirmations, and streamline reconciliation.
Airtel Money and Other Mobile Money
Airtel Money is a separate mobile-money service. A merchant that needs to accept both wallets should confirm whether its gateway provides both, which accounts are eligible, and how receipts and payment statuses differ. Coverage described in this guide is market context. Individual gateways can support different sets of methods.
Card Payments and Bank Transfers
Card payments follow a different path. The acquiring side passes the transaction through a card network to the issuer for an authorisation decision. Capture and settlement can follow later. Ask your acquirer which card data your integration handles and what that means for your PCI DSS scope.
Bank transfers move funds between accounts. Check whether your provider can return a machine-readable reference or whether finance needs to match the bank entry separately.
Payment Gateway vs. Rail: What’s the Difference?
The payment gateway is the software layer that connects your business to multiple payment rails, handling transaction initiation, authentication, and communication. The rail is the underlying network that moves the money. With a direct Daraja integration, your own application connects to M-Pesa. With an aggregator, the merchant can use one integration for the methods enabled by that provider.
- Gateway: Manages APIs, checkout flows, payment links, and dashboards.
- Rail: Executes the transfer of funds (e.g., mobile wallet to bank account).
Match the rails your customers use to the operating job your gateway needs to support. A shop and a subscription business can accept the same method and still require different reporting and recovery tools.
Asynchronous Confirmations: How Payment Status Flows
A request to start an STK Push can be accepted before the customer approves it. Keep the order pending and wait for a verified callback or check the transaction status from your server. Store the gateway attempt identifier along with your own order reference.
- Checkpoint: Ensure your API integration listens for and verifies asynchronous confirmations before updating order status or delivering goods.
On a retry, store the new attempt separately. A late result for the first attempt can still arrive. Before fulfilment, match the confirmed amount and currency to the order, and handle a second success as an exception.
Reconciliation and Settlement: Closing the Loop
Reconciliation is the process of matching transactions reported by the payment gateway with entries in your bank account or mobile money wallet. Settlement is when funds are actually transferred from the payment rail to your business’s account.
- Checkpoint: Regularly download or query transaction reports from your payment gateway dashboard or API. Match these against your own records to identify missing or duplicate payments.
- Checkpoint: Confirm the settlement terms for each enabled method. The customer’s confirmation can arrive well before merchant settlement. See how settlement timing affects the cost of payments.
Keep the payment timestamp and settlement timestamp in separate fields. That makes it easier to distinguish a late settlement from an order that has never been paid.
Integrating Payment APIs: Best Practices for Kenyan Businesses
Payment APIs are the backbone of digital payment in Kenya. The Safaricom Daraja API is the official source for M-Pesa integrations. When choosing a payment gateway, consider:
- The mobile-money, bank and card methods your customers actually need
- PCI DSS compliance for card payments
- Clear documentation and support for asynchronous confirmations
- Dashboard access for monitoring transactions and payouts
- Currency options (KES, USD for cross-border)
Checkpoint: Test your integration in a sandbox environment before going live. Monitor for failed transactions and implement robust error handling.
Streamlining Payments in Kenya: Practical Checkpoints
- Map customer payment preferences (mobile money, card, bank transfer)
- Choose the right payment gateway that supports all relevant rails and payment options
- Decide which system owns the order state and who handles payment exceptions
- Monitor asynchronous notifications and automate reconciliation
- Stay updated with official API documentation and compliance requirements
By following these steps, Kenyan businesses can streamline their payment process, reduce transaction errors, and offer customers seamless online payment experiences.
