{"id":3084,"date":"2026-11-23T10:04:56","date_gmt":"2026-11-23T07:04:56","guid":{"rendered":"https:\/\/www.acesolutionafrica.com\/blog\/?p=3084"},"modified":"2026-11-23T10:04:56","modified_gmt":"2026-11-23T07:04:56","slug":"how-to-integrate-mpesa-into-your-business-website","status":"publish","type":"post","link":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/","title":{"rendered":"How to Integrate M-Pesa into Your Business Website"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3084\" class=\"elementor elementor-3084\">\n\t\t\t\t<div class=\"elementor-element elementor-element-192fa57 e-con-full e-flex e-con e-parent\" data-id=\"192fa57\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-d3be83f elementor-widget elementor-widget-text-editor\" data-id=\"d3be83f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>If you run a business in Kenya, you already know that M-Pesa is not just a payment method. It is the way a huge number of customers pay for almost everything: groceries, school fees, rent, airtime, fuel, bills, bookings and online orders. So when you build or upgrade a business website, one question comes up quickly: how do we let customers pay with M-Pesa directly on the site?<\/p><p>Without integration, the process is clumsy. The customer sees a Paybill number on your website, leaves the page, opens the M-Pesa menu, types the number, the account and the amount, waits for the confirmation SMS, then sends you a screenshot or calls to confirm. You, meanwhile, scroll through messages trying to match payments to orders. Mistakes happen, sales are lost and customers get frustrated.<\/p><p>With proper integration, the experience is smooth. The customer clicks &#8220;Pay with M-Pesa,&#8221; a prompt appears on their phone, they enter their PIN and your website instantly knows that the payment succeeded. The order is confirmed, a receipt is sent and your records update automatically.<\/p><p>This guide explains how M-Pesa integration works, what you need, the main integration options, a step-by-step process for using Safaricom&#8217;s Daraja API, the common mistakes to avoid and how to decide between building it yourself, using a plugin, using an aggregator or hiring a developer. It is written for business owners and managers, with enough technical detail to help you talk confidently with a developer, and a sample code outline for those who want to see how the pieces fit.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-03b88aa e-con-full e-flex e-con e-parent\" data-id=\"03b88aa\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-b6e5b3b elementor-widget elementor-widget-heading\" data-id=\"b6e5b3b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">What \"M-Pesa integration\" actually means<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1f54961 elementor-widget elementor-widget-text-editor\" data-id=\"1f54961\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>M-Pesa integration means connecting your website, app or system to M-Pesa so that payment requests can be triggered and payment confirmations can be received automatically. Safaricom provides this capability through <strong>Daraja<\/strong>, its developer platform and API suite. Daraja opened M-Pesa to developers and businesses so they could link their software directly to the mobile money service.<\/p><p>Through Daraja, a website can:<\/p><ul>\n<li><strong>Request payments from customers<\/strong> by sending a prompt to their phone (STK Push, also known as M-Pesa Express or Lipa na M-Pesa Online).<\/li>\n<li><strong>Receive notifications<\/strong> when customers pay to your Paybill or Till number (C2B, customer to business).<\/li>\n<li><strong>Send money to customers<\/strong> such as refunds, salaries, winnings or commissions (B2C, business to customer).<\/li>\n<li><strong>Pay other businesses<\/strong> (B2B).<\/li>\n<li><strong>Check transaction status<\/strong>, query account balance and reverse transactions in certain situations.<\/li>\n<\/ul><p>For most business websites, STK Push is the key feature, because it creates the smoothest checkout experience. C2B confirmation is also valuable if customers pay by Paybill or Till and you want automatic matching. B2C is useful for refunds, payouts and disbursements.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-fe87c98 e-con-full e-flex e-con e-parent\" data-id=\"fe87c98\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-bbe7cca elementor-widget elementor-widget-heading\" data-id=\"bbe7cca\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Why integrate M-Pesa into your website?<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a46fc86 elementor-widget elementor-widget-text-editor\" data-id=\"a46fc86\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The benefits are practical and measurable.<\/p><p><strong>Higher conversion.<\/strong> The fewer steps between &#8220;I want this&#8221; and &#8220;paid,&#8221; the more sales you complete. STK Push removes the need to leave the page, remember numbers or type account details.<\/p><p><strong>Instant confirmation.<\/strong> Your website knows immediately if a payment succeeded or failed, so orders can be confirmed, tickets issued or services activated without manual checking.<\/p><p><strong>Fewer errors.<\/strong> Typing a Paybill number and account reference by hand invites mistakes. Automatic prompts and references reduce failed or misallocated payments.<\/p><p><strong>Less admin.<\/strong> Staff no longer need to scroll through SMS messages or statements to match payments with orders.<\/p><p><strong>Better customer experience.<\/strong> A seamless mobile checkout builds trust and encourages repeat purchases.<\/p><p><strong>Cleaner records.<\/strong> Each transaction is logged with details that your accountant can reconcile, and reports can be generated automatically.<\/p><p><strong>Wider reach.<\/strong> Customers across the country can pay without visiting you or trusting an informal arrangement.<\/p><p>If you are still deciding what an online presence should include more generally, our article on why your business needs a professional website explains how payments fit into the wider picture.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-53ed15e e-con-full e-flex e-con e-parent\" data-id=\"53ed15e\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-35623af elementor-widget elementor-widget-heading\" data-id=\"35623af\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">What you need before you start<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-910634b elementor-widget elementor-widget-text-editor\" data-id=\"910634b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Before any code is written, make sure you have the basics in place.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-45cd8f1 elementor-widget elementor-widget-heading\" data-id=\"45cd8f1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">1. A Safaricom-issued Paybill or Till number<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-baedbdc elementor-widget elementor-widget-text-editor\" data-id=\"baedbdc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>For production integration through Daraja, you need a Paybill (Lipa na M-Pesa Paybill) or Till (Buy Goods) number issued by Safaricom for your business. A critical detail that many people discover late: shortcodes issued by banks for their own bank-linked Paybills generally cannot be used directly with Daraja for your integration. If you do not yet have an appropriate Safaricom-issued number, you will need to apply for one through Safaricom&#8217;s channels, which usually requires your business registration documents and identification. Requirements and processes can change, so confirm the current steps with Safaricom or with your integration partner.<\/p><p><strong>Paybill vs Till: which should you choose?<\/strong><\/p><ul>\n<li><strong>Paybill<\/strong> is common for businesses that need an account reference, such as schools, landlords, utilities and service providers. The customer enters the account number so you can identify who paid.<\/li>\n<li><strong>Till (Buy Goods)<\/strong> is typical for retail and merchants. Customers pay to the till number without an account reference.<\/li>\n<\/ul><p>For websites, STK Push can attach an account reference or description automatically, so either option can work. Your accountant and business model should guide the choice, including considerations about transaction charges and settlement.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b09ccc0 elementor-widget elementor-widget-heading\" data-id=\"b09ccc0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">2. A Safaricom Daraja developer account<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bc65386 elementor-widget elementor-widget-text-editor\" data-id=\"bc65386\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Registering on the Daraja portal is free. You create an account, then create an &#8220;app&#8221; on the portal, selecting the products you want, such as M-Pesa Express (STK Push) and the sandbox environment. The portal then provides a <strong>Consumer Key<\/strong> and <strong>Consumer Secret<\/strong> for your app. Daraja is free to sign up for and use, although standard M-Pesa transaction charges apply to payments you collect.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ab4e5fb elementor-widget elementor-widget-heading\" data-id=\"ab4e5fb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">3. A website or system capable of server-side code<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9535ec3 elementor-widget elementor-widget-text-editor\" data-id=\"9535ec3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>M-Pesa integration cannot be done with plain HTML alone. Calls to Daraja must be made from your server, not from the visitor&#8217;s browser, because they involve secret credentials that must never be exposed publicly. Your website needs a backend, such as PHP (including WordPress and WooCommerce), Node.js, Python (Django or Flask), Laravel or similar.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5098988 elementor-widget elementor-widget-heading\" data-id=\"5098988\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">4. A secure HTTPS website and public callback URL<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-06687de elementor-widget elementor-widget-text-editor\" data-id=\"06687de\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Daraja sends payment results to a <strong>callback URL<\/strong> on your server. This URL must be publicly accessible over HTTPS. If your site is not yet on a live domain with SSL, you cannot receive real callbacks. During development, developers often use tunnelling tools to expose a local server temporarily for testing.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6e205ce elementor-widget elementor-widget-heading\" data-id=\"6e205ce\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">5. Business processes<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4d53822 elementor-widget elementor-widget-text-editor\" data-id=\"4d53822\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Decide how orders and payments should be linked, what happens if a customer cancels or the payment times out, how refunds will be handled, who monitors failed transactions and how reconciliation will be done.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d859489 elementor-widget elementor-widget-image\" data-id=\"d859489\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-go-live-path.png\" class=\"attachment-full size-full wp-image-3081\" alt=\"Five steps from a Daraja account to live M-Pesa payments\" srcset=\"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-go-live-path.png 1200w, https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-go-live-path-300x169.png 300w, https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-go-live-path-1024x576.png 1024w, https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-go-live-path-768x432.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">The route most business websites take from Daraja account to live payments.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-a3586c5 e-con-full e-flex e-con e-parent\" data-id=\"a3586c5\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-b4b6104 elementor-widget elementor-widget-heading\" data-id=\"b4b6104\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">The main ways to integrate M-Pesa<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-22d3c3d elementor-widget elementor-widget-text-editor\" data-id=\"22d3c3d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>There is no single correct method. The best option depends on your platform, budget, technical resources and volume.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-62b2e94 elementor-widget elementor-widget-heading\" data-id=\"62b2e94\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Option 1: Direct integration with the Daraja API<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7666a8c elementor-widget elementor-widget-text-editor\" data-id=\"7666a8c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>You build the integration yourself or hire a developer to connect your site directly to Safaricom.<\/p><p><strong>Pros:<\/strong> Full control, no aggregator fees, flexible customisation, direct relationship with Safaricom, and the ability to build tailored reconciliation and reporting.\n<strong>Cons:<\/strong> More technical work, you manage credentials, testing and security, and you must go through Safaricom&#8217;s go-live process.\n<strong>Best for:<\/strong> Businesses with developers or an agency, stores with higher volume, and custom systems.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-768bf06 elementor-widget elementor-widget-heading\" data-id=\"768bf06\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Option 2: A ready-made plugin (WooCommerce and others)<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1354444 elementor-widget elementor-widget-text-editor\" data-id=\"1354444\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>If your site runs on WordPress with WooCommerce, there are plugins that add M-Pesa as a payment method. Many use Daraja behind the scenes and require you to enter your credentials in the settings.<\/p><p><strong>Pros:<\/strong> Fast setup, lower cost, no coding for basic use.\n<strong>Cons:<\/strong> Quality varies. Some plugins are poorly maintained or insecure. Customisation and reconciliation features may be limited.\n<strong>Best for:<\/strong> Small and medium WooCommerce stores. Always choose actively maintained plugins with good reviews, and have a developer configure and test them.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5209d7d elementor-widget elementor-widget-heading\" data-id=\"5209d7d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Option 3: A payment aggregator or gateway<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-bc74eab elementor-widget elementor-widget-text-editor\" data-id=\"bc74eab\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Several payment providers offer a single integration that supports M-Pesa, cards and other methods. Examples include Pesapal, Flutterwave, IntaSend and similar services, among others. They manage much of the Safaricom connection and compliance for you.<\/p><p><strong>Pros:<\/strong> Faster launch, multiple payment methods under one integration, helpful dashboards and support.\n<strong>Cons:<\/strong> Transaction fees, dependence on a third party, and possibly slower settlement or different reconciliation processes.\n<strong>Best for:<\/strong> Businesses that want multiple payment options quickly and are comfortable paying fees for convenience.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c282dac elementor-widget elementor-widget-heading\" data-id=\"c282dac\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Option 4: Custom development by an agency<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-055fd80 elementor-widget elementor-widget-text-editor\" data-id=\"055fd80\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>For complex systems, such as marketplaces, school fee platforms, subscription services or fintech products, a custom integration handles multiple flows: STK Push, C2B confirmation, B2C payouts, reversals, wallet logic and detailed reporting.<\/p><p><strong>Pros:<\/strong> Tailored to your business rules and scalable.\n<strong>Cons:<\/strong> Higher cost and longer timeline.\n<strong>Best for:<\/strong> Businesses where payments are central to the product.<\/p><p>If you are weighing these choices alongside your overall website approach, see our comparison of WordPress and custom website development in Kenya.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-9d4a784 e-con-full e-flex e-con e-parent\" data-id=\"9d4a784\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t<div class=\"elementor-element elementor-element-9c57ab2 elementor-widget elementor-widget-heading\" data-id=\"9c57ab2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Need M-Pesa on your website?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8ce14b7 elementor-widget elementor-widget-text-editor\" data-id=\"8ce14b7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>We can recommend and build the right method for you, direct Daraja, a plugin or an aggregator, and test it before launch.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5acd36d elementor-align-left elementor-widget elementor-widget-button\" data-id=\"5acd36d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-md\" href=\"https:\/\/www.acesolutionafrica.com\/website-design-kenya\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Talk to our team<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-dab1f36 e-con-full e-flex e-con e-parent\" data-id=\"dab1f36\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-fe3dd6c elementor-widget elementor-widget-heading\" data-id=\"fe3dd6c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">How STK Push works, in plain language<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b96a712 elementor-widget elementor-widget-text-editor\" data-id=\"b96a712\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>STK Push is the heart of most website integrations, so it is worth understanding the flow.<\/p><ol>\n<li><strong>Customer decides to pay.<\/strong> On your website, they choose M-Pesa and enter their phone number.<\/li>\n<li><strong>Your server asks Safaricom for permission.<\/strong> It requests an access token from Daraja using your Consumer Key and Secret.<\/li>\n<li><strong>Your server sends the payment request.<\/strong> Using the token, your server sends a request to the STK Push endpoint, with the amount, phone number, your shortcode, a callback URL and a reference.<\/li>\n<li><strong>Safaricom prompts the customer.<\/strong> A pop-up appears on the customer&#8217;s phone asking them to enter their M-Pesa PIN.<\/li>\n<li><strong>Customer confirms or cancels.<\/strong> They enter the PIN, or cancel, or let it time out.<\/li>\n<li><strong>Safaricom processes the payment.<\/strong> If successful, money moves from the customer&#8217;s M-Pesa account to your shortcode.<\/li>\n<li><strong>Safaricom notifies your server.<\/strong> It sends a callback to your URL with the result, including a result code, a description and, for successful payments, details such as the M-Pesa receipt number, amount and phone number.<\/li>\n<li><strong>Your website updates the order.<\/strong> If the payment succeeded, you mark the order as paid and trigger confirmation emails, SMS, tickets or delivery processes. If it failed, you inform the customer and offer to retry.<\/li>\n<li><strong>Customer sees the result.<\/strong> Your site shows a success or failure message, typically after checking or polling the order status.<\/li>\n<\/ol><p>The customer experience feels instant, though behind the scenes there are several handshakes.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f7b1bc3 elementor-widget elementor-widget-image\" data-id=\"f7b1bc3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t<figure class=\"wp-caption\">\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-stk-push-flow.png\" class=\"attachment-full size-full wp-image-3082\" alt=\"Sequence of an M-Pesa STK Push payment between customer, website and Safaricom Daraja\" srcset=\"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-stk-push-flow.png 1200w, https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-stk-push-flow-300x169.png 300w, https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-stk-push-flow-1024x576.png 1024w, https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/img-07-stk-push-flow-768x432.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/>\t\t\t\t\t\t\t\t\t\t\t<figcaption class=\"widget-image-caption wp-caption-text\">How an STK Push payment flows between the customer, your website and Safaricom Daraja.<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-f84351d e-con-full e-flex e-con e-parent\" data-id=\"f84351d\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-2b17760 elementor-widget elementor-widget-heading\" data-id=\"2b17760\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Step-by-step: integrating M-Pesa Express (STK Push) with Daraja<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9110d27 elementor-widget elementor-widget-text-editor\" data-id=\"9110d27\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Here is a practical outline. Your developer will adapt details to your platform and the current Daraja documentation, which you should always treat as the authoritative source because details and endpoints can be updated.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-177563d elementor-widget elementor-widget-heading\" data-id=\"177563d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 1: Create a Daraja account and an app<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4de058c elementor-widget elementor-widget-text-editor\" data-id=\"4de058c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Register on the Daraja portal, create a new app, and tick the products you need. For STK Push, select the M-Pesa Express (Lipa na M-Pesa Online) and sandbox options. Copy your <strong>Consumer Key<\/strong> and <strong>Consumer Secret<\/strong> and store them securely, for example in environment variables rather than inside public code.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7237027 elementor-widget elementor-widget-heading\" data-id=\"7237027\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 2: Understand the sandbox<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-10e018d elementor-widget elementor-widget-text-editor\" data-id=\"10e018d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The sandbox is a safe testing environment where no real money moves. Safaricom publishes test values for it, including a test shortcode and passkey. Developers commonly use these sample values to build and test the flow before going live. Sandbox behaviour can differ slightly from production, so do not assume that everything will behave identically when live.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-983fa3b elementor-widget elementor-widget-heading\" data-id=\"983fa3b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 3: Get an access token<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-37f95ef elementor-widget elementor-widget-text-editor\" data-id=\"37f95ef\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Your server requests an OAuth access token from Daraja by sending your Consumer Key and Consumer Secret using HTTP Basic authentication to the token endpoint. The response includes an access token and an expiry time. Tokens expire after a short period, so your code should request a fresh token when needed rather than hard-coding one.<\/p><p>The base URLs differ between sandbox and production, and your code should switch between them using configuration, not by editing code.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b5ad4f5 elementor-widget elementor-widget-heading\" data-id=\"b5ad4f5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 4: Generate the password and timestamp<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1b5d315 elementor-widget elementor-widget-text-editor\" data-id=\"1b5d315\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Each STK Push request requires a timestamp in a specified format (year, month, day, hour, minute and second) and a password. The password is created by joining your business shortcode, your passkey and the timestamp, then encoding the result in Base64. Production credentials, including the passkey, are issued to you when your integration is approved for go-live.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0cc42df elementor-widget elementor-widget-heading\" data-id=\"0cc42df\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 5: Send the STK Push request<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-edf1afe elementor-widget elementor-widget-text-editor\" data-id=\"edf1afe\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Your server sends a POST request to the M-Pesa Express endpoint with a JSON body including fields such as:<\/p><ul>\n<li><strong>BusinessShortCode:<\/strong> your Paybill or Till shortcode.<\/li>\n<li><strong>Password:<\/strong> the Base64 password described above.<\/li>\n<li><strong>Timestamp:<\/strong> the timestamp used to create the password.<\/li>\n<li><strong>TransactionType:<\/strong> commonly &#8220;CustomerPayBillOnline&#8221; for Paybill or &#8220;CustomerBuyGoodsOnline&#8221; for Till.<\/li>\n<li><strong>Amount:<\/strong> the amount to charge.<\/li>\n<li><strong>PartyA:<\/strong> the customer&#8217;s phone number in international format, such as 2547XXXXXXXX.<\/li>\n<li><strong>PartyB:<\/strong> the shortcode that receives the funds.<\/li>\n<li><strong>PhoneNumber:<\/strong> the phone to prompt, in the same international format.<\/li>\n<li><strong>CallBackURL:<\/strong> your public HTTPS endpoint for results.<\/li>\n<li><strong>AccountReference:<\/strong> a reference such as an order number or account ID.<\/li>\n<li><strong>TransactionDesc:<\/strong> a short description of the transaction.<\/li>\n<\/ul><p>Daraja responds immediately with an acknowledgment that includes identifiers such as the MerchantRequestID and CheckoutRequestID. This only means that the request was accepted, not that the customer has paid. Store these IDs against the order so you can match the later callback.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-62d46e5 elementor-widget elementor-widget-heading\" data-id=\"62d46e5\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 6: Handle the callback<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-dc74724 elementor-widget elementor-widget-text-editor\" data-id=\"dc74724\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>When the customer completes, cancels or times out, Safaricom sends a POST request to your callback URL. Your endpoint should:<\/p><ul>\n<li>Accept and log the raw JSON safely.<\/li>\n<li>Read the result code, where zero typically indicates success and other values indicate different failure reasons.<\/li>\n<li>Match the CheckoutRequestID to the correct order in your database.<\/li>\n<li>For successful payments, record the M-Pesa receipt number, amount, transaction date and phone number.<\/li>\n<li>Update the order status accordingly.<\/li>\n<li>Respond quickly with an acknowledgment so Safaricom knows you received it.<\/li>\n<li>Avoid processing the same callback twice (idempotency), since duplicate notifications can occur.<\/li>\n<\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-24783ad elementor-widget elementor-widget-heading\" data-id=\"24783ad\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 7: Provide status feedback to the customer<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ce73dac elementor-widget elementor-widget-text-editor\" data-id=\"ce73dac\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Customers need to know what is happening. After sending the prompt, show a message such as &#8220;Check your phone and enter your M-Pesa PIN.&#8221; Your frontend can poll your server for the order status every few seconds, or use real-time updates, then display success or an error message with an option to retry. You can also use Daraja&#8217;s transaction status query for STK Push to check results if a callback does not arrive.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1b81914 elementor-widget elementor-widget-heading\" data-id=\"1b81914\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 8: Add reconciliation and reporting<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c779f39 elementor-widget elementor-widget-text-editor\" data-id=\"c779f39\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Record every attempt, success and failure. Create an admin view that lists transactions, filters by date and status, and exports data for your accountant. For businesses with higher volume, consider automatic reconciliation against M-Pesa statements and alerts for mismatches.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2e2b551 elementor-widget elementor-widget-heading\" data-id=\"2e2b551\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 9: Test thoroughly in the sandbox<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5820470 elementor-widget elementor-widget-text-editor\" data-id=\"5820470\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Test the following scenarios before going live:<\/p><ul>\n<li>Successful payment<\/li>\n<li>Customer cancels the prompt<\/li>\n<li>Customer enters the wrong PIN or has insufficient funds<\/li>\n<li>Prompt times out with no response<\/li>\n<li>Invalid phone number format<\/li>\n<li>Duplicate callbacks<\/li>\n<li>Callback arrives late or never arrives<\/li>\n<li>Customer closes the browser mid-payment<\/li>\n<li>Amount changes or order edits after initiation<\/li>\n<\/ul><p>A robust integration deals gracefully with all of these.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a977a87 elementor-widget elementor-widget-heading\" data-id=\"a977a87\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Step 10: Apply for production and go live<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8336cd0 elementor-widget elementor-widget-text-editor\" data-id=\"8336cd0\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>When your integration works in the sandbox, you apply for production access (go-live) through the Daraja portal, providing the details of your app and Paybill or Till number. Safaricom reviews and issues production credentials, including the passkey that corresponds to your shortcode. You then switch your configuration to production endpoints and credentials, test with small real transactions and monitor closely.<\/p><p>Approval timelines vary, so start the go-live process early. Have your business documentation and shortcode details ready, and make sure your callback URL is live and secure.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-9e30aae e-con-full e-flex e-con e-parent\" data-id=\"9e30aae\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-9f4e5bf elementor-widget elementor-widget-heading\" data-id=\"9f4e5bf\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">A simplified code outline<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3292a45 elementor-widget elementor-widget-text-editor\" data-id=\"3292a45\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The example below is a simplified PHP illustration of the idea, to help you understand how the parts fit together. It is not production-ready code, and your developer should add proper validation, error handling, logging, security and configuration management. Always refer to Safaricom&#8217;s current Daraja documentation for exact endpoints and parameters.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0f1608a elementor-widget elementor-widget-html\" data-id=\"0f1608a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre style=\"background:#0f172a;color:#e2e8f0;padding:16px;border-radius:8px;overflow:auto;font-size:0.9em;line-height:1.5;\"><code>&lt;?php\n\/\/ 1. Configuration (store real values in environment variables, never in public code)\n$consumerKey    = getenv('MPESA_CONSUMER_KEY');\n$consumerSecret = getenv('MPESA_CONSUMER_SECRET');\n$shortcode      = getenv('MPESA_SHORTCODE');\n$passkey        = getenv('MPESA_PASSKEY');\n$baseUrl        = getenv('MPESA_BASE_URL'); \/\/ sandbox or production\n$callbackUrl    = 'https:\/\/www.yourdomain.co.ke\/mpesa\/callback.php';\n\n\/\/ 2. Get an access token\nfunction getAccessToken($baseUrl, $key, $secret) {\n    $ch = curl_init($baseUrl . '\/oauth\/v1\/generate?grant_type=client_credentials');\n    curl_setopt($ch, CURLOPT_USERPWD, $key . ':' . $secret);\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n    $response = json_decode(curl_exec($ch), true);\n    curl_close($ch);\n    return $response['access_token'] ?? null;\n}\n\n\/\/ 3. Send an STK Push request\nfunction stkPush($baseUrl, $token, $shortcode, $passkey, $phone, $amount, $orderRef, $callbackUrl) {\n    $timestamp = date('YmdHis');\n    $password  = base64_encode($shortcode . $passkey . $timestamp);\n\n    $payload = [\n        'BusinessShortCode' =&gt; $shortcode,\n        'Password'          =&gt; $password,\n        'Timestamp'         =&gt; $timestamp,\n        'TransactionType'   =&gt; 'CustomerPayBillOnline',\n        'Amount'            =&gt; $amount,\n        'PartyA'            =&gt; $phone,        \/\/ e.g. 2547XXXXXXXX\n        'PartyB'            =&gt; $shortcode,\n        'PhoneNumber'       =&gt; $phone,\n        'CallBackURL'       =&gt; $callbackUrl,\n        'AccountReference'  =&gt; $orderRef,\n        'TransactionDesc'   =&gt; 'Payment for order ' . $orderRef,\n    ];\n\n    $ch = curl_init($baseUrl . '\/mpesa\/stkpush\/v1\/processrequest');\n    curl_setopt($ch, CURLOPT_HTTPHEADER, [\n        'Authorization: Bearer ' . $token,\n        'Content-Type: application\/json',\n    ]);\n    curl_setopt($ch, CURLOPT_POST, true);\n    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n    $response = json_decode(curl_exec($ch), true);\n    curl_close($ch);\n    return $response; \/\/ contains MerchantRequestID and CheckoutRequestID\n}\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-aad27d4 elementor-widget elementor-widget-text-editor\" data-id=\"aad27d4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>And a simplified callback receiver:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-98608ac elementor-widget elementor-widget-html\" data-id=\"98608ac\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<pre style=\"background:#0f172a;color:#e2e8f0;padding:16px;border-radius:8px;overflow:auto;font-size:0.9em;line-height:1.5;\"><code>&lt;?php\n\/\/ callback.php: receives the result from Safaricom\n$raw  = file_get_contents('php:\/\/input');\n$data = json_decode($raw, true);\n\n$callback   = $data['Body']['stkCallback'] ?? [];\n$resultCode = $callback['ResultCode'] ?? null;\n$checkoutId = $callback['CheckoutRequestID'] ?? null;\n\nif ($resultCode === 0) {\n    \/\/ Payment succeeded: read the receipt number, amount and phone from CallbackMetadata,\n    \/\/ find the order by $checkoutId, and mark it as paid (once only).\n} else {\n    \/\/ Payment failed or was cancelled: update the order status and allow retry.\n}\n\n\/\/ Acknowledge receipt to Safaricom\nheader('Content-Type: application\/json');\necho json_encode(['ResultCode' =&gt; 0, 'ResultDesc' =&gt; 'Accepted']);\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f2ff941 elementor-widget elementor-widget-text-editor\" data-id=\"f2ff941\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Note how the secret credentials stay on the server, the callback is a separate endpoint and the order is matched using an ID created at the start of the transaction.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-ec40527 e-con-full e-flex e-con e-parent\" data-id=\"ec40527\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-6797373 elementor-widget elementor-widget-heading\" data-id=\"6797373\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Integrating M-Pesa on WordPress and WooCommerce<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-206d23a elementor-widget elementor-widget-text-editor\" data-id=\"206d23a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>For many Kenyan businesses, the practical route is WordPress with WooCommerce and an M-Pesa plugin. A sensible process looks like this:<\/p><ol>\n<li><strong>Choose a reputable plugin.<\/strong> Check the last update date, support responsiveness, reviews and compatibility with your versions of WordPress and WooCommerce.<\/li>\n<li><strong>Install and configure it.<\/strong> Enter your shortcode, Consumer Key, Consumer Secret, passkey and callback settings in the plugin&#8217;s settings page.<\/li>\n<li><strong>Test in the sandbox first.<\/strong> Many plugins have a sandbox mode. Place test orders and confirm that statuses change correctly.<\/li>\n<li><strong>Check order status handling.<\/strong> Make sure paid orders move to &#8220;processing&#8221; or &#8220;completed&#8221; and failed payments are handled gracefully.<\/li>\n<li><strong>Test on real phones.<\/strong> Use different networks and handsets.<\/li>\n<li><strong>Go live with small test transactions.<\/strong> Run a few small real payments and confirm they appear properly in your records.<\/li>\n<li><strong>Monitor.<\/strong> Watch for failures, delayed callbacks and abandoned payments.<\/li>\n<\/ol><p>Be aware that plugins are third-party code. Keep them updated, avoid pirated versions, restrict admin access and back up your site regularly.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-7874c2a e-con-full e-flex e-con e-parent\" data-id=\"7874c2a\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-0f787fc elementor-widget elementor-widget-heading\" data-id=\"0f787fc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Using Paybill or Till confirmation (C2B)<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-298fb97 elementor-widget elementor-widget-text-editor\" data-id=\"298fb97\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Not every customer will use STK Push. Some will still pay manually to your Paybill or Till number, for example when they are in a shop or when they prefer to enter details themselves. C2B integration lets your system receive automatic notifications of these payments through registered validation and confirmation URLs.<\/p><p>With C2B, you can:<\/p><ul>\n<li>Match payments to invoices using the account number.<\/li>\n<li>Mark invoices as paid automatically.<\/li>\n<li>Handle top-ups, school fees, rent, subscriptions or utility payments.<\/li>\n<li>Reduce manual statement checking.<\/li>\n<\/ul><p>For businesses that receive many manual payments, C2B confirmation plus STK Push provides coverage for both customer behaviours.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-eb9babb e-con-full e-flex e-con e-parent\" data-id=\"eb9babb\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-108ee55 elementor-widget elementor-widget-heading\" data-id=\"108ee55\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Paying customers: B2C and refunds<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-05f4808 elementor-widget elementor-widget-text-editor\" data-id=\"05f4808\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>If your business needs to send money, such as refunds, commissions, salaries, winnings or supplier payments, the B2C API lets you disburse funds from your business account to customer phones. This requires additional approvals, secure credential handling, strong access controls and careful logging, because money is leaving your account. Many businesses start with STK Push collections and add B2C later when they have a clear need and strong controls in place.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-e568b0e e-con-full e-flex e-con e-parent\" data-id=\"e568b0e\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-362d7ca elementor-widget elementor-widget-heading\" data-id=\"362d7ca\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Security best practices<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-88f295c elementor-widget elementor-widget-text-editor\" data-id=\"88f295c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Payments demand extra care. Follow these principles.<\/p><ul>\n<li><strong>Keep secrets on the server.<\/strong> Never expose your Consumer Secret, passkey or tokens in browser code or public repositories.<\/li>\n<li><strong>Use HTTPS everywhere.<\/strong> Both your site and callback endpoints should be encrypted.<\/li>\n<li><strong>Validate callbacks.<\/strong> Confirm that the CheckoutRequestID matches a pending transaction you created, and verify amounts against the order before marking it as paid.<\/li>\n<li><strong>Prevent duplicates.<\/strong> Ensure a callback cannot mark the same order as paid twice or trigger duplicate deliveries.<\/li>\n<li><strong>Restrict access.<\/strong> Limit who can view transaction data and change payment settings, and use strong passwords and two-factor authentication.<\/li>\n<li><strong>Log carefully.<\/strong> Keep detailed logs for troubleshooting, but do not log secrets.<\/li>\n<li><strong>Rate-limit and protect forms.<\/strong> Prevent abuse, such as attackers spamming STK prompts to random phone numbers.<\/li>\n<li><strong>Keep software updated.<\/strong> Update WordPress, plugins, frameworks and server software promptly.<\/li>\n<li><strong>Back up and monitor.<\/strong> Regular backups and uptime monitoring help you recover quickly from problems.<\/li>\n<li><strong>Respect data protection laws.<\/strong> You will handle personal data such as phone numbers and transaction details. Collect only what you need, protect it, publish a clear privacy policy and follow applicable requirements under Kenya&#8217;s Data Protection Act. Take legal advice on your specific obligations.<\/li>\n<\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-651508d e-con-full e-flex e-con e-parent\" data-id=\"651508d\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t<div class=\"elementor-element elementor-element-58f861d elementor-widget elementor-widget-heading\" data-id=\"58f861d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Want payments handled securely and reliably?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-446d0bc elementor-widget elementor-widget-text-editor\" data-id=\"446d0bc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Protected credentials, validated callbacks and reconciliation built in from day one.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-561231a elementor-align-left elementor-widget elementor-widget-button\" data-id=\"561231a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-md\" href=\"https:\/\/www.acesolutionafrica.com\/website-design-kenya\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Explore our web design services<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-f1390e9 e-con-full e-flex e-con e-parent\" data-id=\"f1390e9\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-d68c70f elementor-widget elementor-widget-heading\" data-id=\"d68c70f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Common problems and how to fix them<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-65528d9 elementor-widget elementor-widget-text-editor\" data-id=\"65528d9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><strong>The STK prompt does not appear on the phone.<\/strong> Check the phone number format (it should be in international format starting with 254), that the number is registered for M-Pesa, that you are using the correct shortcode and credentials for the environment, and that there is no network or SIM issue. In the sandbox, remember that test behaviour differs from production.<\/p><p><strong>The callback is never received.<\/strong> Make sure the callback URL is public, uses HTTPS, has no blocking security rules, and returns a valid response quickly. Firewalls, redirects and incorrect paths are common culprits. Use the transaction status query as a fallback.<\/p><p><strong>Authentication errors.<\/strong> Confirm that your Consumer Key and Secret are correct, that you are using the right base URL for the environment and that your token has not expired.<\/p><p><strong>Wrong password or timestamp errors.<\/strong> Check the order of the concatenated values, the timestamp format and that the passkey matches the shortcode and environment.<\/p><p><strong>Duplicate or missing orders.<\/strong> Implement idempotent callback handling and store transaction identifiers from the start.<\/p><p><strong>Customers pay but the order stays pending.<\/strong> This often happens when the callback fails or the customer closes the page. Build a reconciliation job that checks pending transactions and updates them using the status API.<\/p><p><strong>Amount mismatch.<\/strong> Always compare the paid amount against the order total on your server rather than trusting client-side values.<\/p><p><strong>Production approval delays.<\/strong> Prepare documents early, ensure your shortcode and callback URL are ready and follow up politely with Safaricom support if needed.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-5183ad0 e-con-full e-flex e-con e-parent\" data-id=\"5183ad0\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-f3a62c3 elementor-widget elementor-widget-heading\" data-id=\"f3a62c3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">What does M-Pesa integration cost?<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0df339d elementor-widget elementor-widget-text-editor\" data-id=\"0df339d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Costs vary with approach and complexity.<\/p><ul>\n<li><strong>Daraja itself:<\/strong> Free to register and use. Standard M-Pesa transaction charges apply to payments.<\/li>\n<li><strong>Plugins:<\/strong> May be free or paid, sometimes with annual licences. Setup and testing by a developer are additional.<\/li>\n<li><strong>Aggregators:<\/strong> Usually charge a percentage or fixed fee per transaction, and sometimes setup or monthly fees.<\/li>\n<li><strong>Developer or agency fees:<\/strong> A basic STK Push integration is often priced in the range of tens of thousands of shillings, while advanced integrations with C2B, B2C, reconciliation and dashboards cost more, depending on scope.<\/li>\n<li><strong>Maintenance:<\/strong> Ongoing updates, monitoring and support, particularly if Safaricom updates APIs or credentials need renewal.<\/li>\n<\/ul><p>For a broader view of costs when selling online, see our guide to ecommerce website development costs in Kenya.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-bf38882 e-con-full e-flex e-con e-parent\" data-id=\"bf38882\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-fcbb209 elementor-widget elementor-widget-heading\" data-id=\"fcbb209\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Questions to ask your developer or agency<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0d2962a elementor-widget elementor-widget-text-editor\" data-id=\"0d2962a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>When you hire someone to integrate M-Pesa, ask:<\/p><ol>\n<li>Have you integrated Daraja before? Can you show examples or references?<\/li>\n<li>Will you integrate directly with Daraja, use a plugin or use an aggregator, and why?<\/li>\n<li>Does the price include sandbox testing, go-live support and training?<\/li>\n<li>How will you handle callbacks, failed payments, timeouts and duplicates?<\/li>\n<li>How will payments be reconciled with orders and accounting records?<\/li>\n<li>How will you protect credentials and customer data?<\/li>\n<li>What happens if Safaricom changes an API or my credentials need renewal?<\/li>\n<li>Who owns the code and the Daraja app credentials?<\/li>\n<li>What ongoing support and maintenance do you offer?<\/li>\n<li>How long will the integration take, including the go-live approval process?<\/li>\n<\/ol><p>Experienced providers answer clearly and can explain trade-offs. If you would like a team that builds and supports payment-enabled websites for Kenyan businesses, you can learn more about our <a href=\"https:\/\/www.acesolutionafrica.com\/website-design-kenya\/\">website design and development in Kenya<\/a> and discuss your payment needs with us.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-7bb5bb7 e-con-full e-flex e-con e-parent\" data-id=\"7bb5bb7\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-b5e3be4 elementor-widget elementor-widget-heading\" data-id=\"b5e3be4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Planning your integration: a checklist<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1320044 elementor-widget elementor-widget-text-editor\" data-id=\"1320044\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Use this checklist to make sure nothing is missed.<\/p><ul>\n<li>\u2610 Safaricom-issued Paybill or Till number confirmed<\/li>\n<li>\u2610 Daraja developer account created and app configured<\/li>\n<li>\u2610 Hosting with HTTPS and a public callback URL ready<\/li>\n<li>\u2610 Integration method chosen: direct, plugin, aggregator or custom<\/li>\n<li>\u2610 Order and payment flow designed, including failure and retry paths<\/li>\n<li>\u2610 Sandbox testing completed across all scenarios<\/li>\n<li>\u2610 Security measures in place: secrets protected, callbacks validated, access controlled<\/li>\n<li>\u2610 Reconciliation and reporting set up<\/li>\n<li>\u2610 Customer messages and receipts written<\/li>\n<li>\u2610 Terms, refund policy and privacy policy published<\/li>\n<li>\u2610 Production credentials obtained and configuration switched<\/li>\n<li>\u2610 Small live transactions tested<\/li>\n<li>\u2610 Monitoring, backups and support plan arranged<\/li>\n<\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-02ffc02 e-con-full e-flex e-con e-parent\" data-id=\"02ffc02\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-0967680 elementor-widget elementor-widget-heading\" data-id=\"0967680\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Frequently asked questions<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f887a28 elementor-widget elementor-widget-heading\" data-id=\"f887a28\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Do I need a registered business to integrate M-Pesa?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-00f1847 elementor-widget elementor-widget-text-editor\" data-id=\"00f1847\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>For production Daraja access, you generally need a valid Safaricom-issued Paybill or Till number, which usually requires business documentation. Requirements can change, so confirm the current process with Safaricom or a qualified integration partner.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-02c0e3c elementor-widget elementor-widget-heading\" data-id=\"02c0e3c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Can I integrate M-Pesa with a simple HTML website?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cef2a85 elementor-widget elementor-widget-text-editor\" data-id=\"cef2a85\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Not directly. HTML cannot safely call Daraja on its own, because your credentials would be exposed. You need a backend in PHP, Node.js, Python or another server-side language, or you can use a hosted payment page from an aggregator.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-411a924 elementor-widget elementor-widget-heading\" data-id=\"411a924\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Is Daraja free?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-14cd010 elementor-widget elementor-widget-text-editor\" data-id=\"14cd010\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Registering and using the Daraja developer platform is free, although normal M-Pesa transaction charges apply to payments you collect. Developer time, hosting and any aggregator fees are separate costs.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0d95914 elementor-widget elementor-widget-heading\" data-id=\"0d95914\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">How long does integration take?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-515618b elementor-widget elementor-widget-text-editor\" data-id=\"515618b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A standard STK Push integration can often be built and tested in one to two weeks by an experienced developer, but the go-live approval process and your own readiness can extend the timeline.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d6f37ae elementor-widget elementor-widget-heading\" data-id=\"d6f37ae\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Should I use STK Push or ask customers to pay to my Paybill manually?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9bc5158 elementor-widget elementor-widget-text-editor\" data-id=\"9bc5158\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>STK Push gives a smoother, more reliable experience for online checkout, with automatic confirmation. Manual Paybill payments still have a role, and C2B confirmation can capture them automatically.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c365176 elementor-widget elementor-widget-heading\" data-id=\"c365176\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Can I accept both M-Pesa and cards?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-645903e elementor-widget elementor-widget-text-editor\" data-id=\"645903e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Yes. You can integrate M-Pesa directly and add a card gateway, or use an aggregator that supports both under a single integration.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d51b52f elementor-widget elementor-widget-heading\" data-id=\"d51b52f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">What if a customer pays but my website does not update?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d4c3e5e elementor-widget elementor-widget-text-editor\" data-id=\"d4c3e5e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>This usually means the callback failed. Use the transaction status query, check your logs and run a reconciliation process. Good integrations include automatic checks for pending payments.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3e98262 elementor-widget elementor-widget-heading\" data-id=\"3e98262\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Are M-Pesa plugins safe?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a504ad1 elementor-widget elementor-widget-text-editor\" data-id=\"a504ad1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Reputable, actively maintained plugins can be safe when properly configured and kept updated. Avoid pirated or abandoned plugins, and have a developer review the setup.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a481324 elementor-widget elementor-widget-heading\" data-id=\"a481324\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Can I send refunds through the website?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3e0f535 elementor-widget elementor-widget-text-editor\" data-id=\"3e0f535\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Refunds can be processed through B2C or reversal tools where appropriate, but they require additional approvals and strong controls. Many businesses handle refunds manually at first.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3ef4c26 elementor-widget elementor-widget-heading\" data-id=\"3ef4c26\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Will M-Pesa integration make my site slower?<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-41d8a49 elementor-widget elementor-widget-text-editor\" data-id=\"41d8a49\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>A properly built integration should not noticeably affect performance. Payment calls happen on demand during checkout, not on every page load.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-f849ef1 e-con-full e-flex e-con e-parent\" data-id=\"f849ef1\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e02a497 elementor-widget elementor-widget-heading\" data-id=\"e02a497\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Final thoughts<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-422bb9c elementor-widget elementor-widget-text-editor\" data-id=\"422bb9c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>M-Pesa integration is one of the most valuable upgrades you can make to a Kenyan business website. It turns a passive online brochure into an active sales channel that can take payments from customers anywhere, at any hour, with a payment method they already know and trust.<\/p><p>The technical details involve credentials, callbacks, testing and security, but the principles are straightforward: choose the integration route that suits your business, test thoroughly in the sandbox, secure your credentials and callbacks, plan for failures and reconciliation, and go live carefully. Work with developers who have done it before and who stay available after launch, because payments are too important to leave unattended.<\/p><p>If you are planning a new website, an online store or an upgrade to accept M-Pesa payments, our team can help you design the right solution for your business. Take a look at our approach to <a href=\"https:\/\/www.acesolutionafrica.com\/website-design-kenya\/\">website design in Kenya<\/a> and get in touch to talk about your goals, your payment flows and your timeline. A well-planned M-Pesa integration can make every future sale easier for both you and your customers.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-7adadae e-con-full e-flex e-con e-parent\" data-id=\"7adadae\" data-element_type=\"container\" data-e-type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t<div class=\"elementor-element elementor-element-55a5de6 elementor-widget elementor-widget-heading\" data-id=\"55a5de6\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Let us integrate M-Pesa for you<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1338f70 elementor-widget elementor-widget-text-editor\" data-id=\"1338f70\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Tell us about your website and payment flow and we will scope a clean, tested integration.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6e4aebf elementor-align-left elementor-widget elementor-widget-button\" data-id=\"6e4aebf\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-md\" href=\"https:\/\/www.acesolutionafrica.com\/website-design-kenya\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Request your free quote<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>If you run a business in Kenya, you already know that M-Pesa is not just a payment method. It is the way a huge number of customers pay for almost everything: groceries, school fees, rent, airtime, fuel, bills, bookings and online orders. So when you build or upgrade a business website, one&#8230;<\/p>\n","protected":false},"author":1,"featured_media":3083,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[89,94],"tags":[96,95,98,97],"class_list":["post-3084","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ecommerce","category-payments","tag-daraja-api","tag-m-pesa","tag-payment-integration","tag-stk-push"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Integrate M-Pesa into Your Business Website (Step-by-Step Guide)<\/title>\n<meta name=\"description\" content=\"Learn how to integrate M-Pesa into your website in Kenya: Daraja API, STK Push, Paybill vs Till, sandbox testing, callbacks, security, plugins and go-live steps.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Integrate M-Pesa into Your Business Website (Step-by-Step Guide)\" \/>\n<meta property=\"og:description\" content=\"Learn how to integrate M-Pesa into your website in Kenya: Daraja API, STK Push, Paybill vs Till, sandbox testing, callbacks, security, plugins and go-live steps.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/\" \/>\n<meta property=\"og:site_name\" content=\"Ace Solution Africa Ltd\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/web.facebook.com\/AceSolutionAfricaLtd\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-23T07:04:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/featured-07-mpesa-integration.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mutari Diawara\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@AceSolutionAf\" \/>\n<meta name=\"twitter:site\" content=\"@AceSolutionAf\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mutari Diawara\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"24 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/\"},\"author\":{\"name\":\"Mutari Diawara\",\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/#\\\/schema\\\/person\\\/5b37502979f30e19194f9aff2b4a493e\"},\"headline\":\"How to Integrate M-Pesa into Your Business Website\",\"datePublished\":\"2026-11-23T07:04:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/\"},\"wordCount\":4476,\"publisher\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/featured-07-mpesa-integration.jpg\",\"keywords\":[\"Daraja API\",\"M-Pesa\",\"payment integration\",\"STK Push\"],\"articleSection\":[\"Ecommerce\",\"Payments\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/\",\"url\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/\",\"name\":\"How to Integrate M-Pesa into Your Business Website (Step-by-Step Guide)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/featured-07-mpesa-integration.jpg\",\"datePublished\":\"2026-11-23T07:04:56+00:00\",\"description\":\"Learn how to integrate M-Pesa into your website in Kenya: Daraja API, STK Push, Paybill vs Till, sandbox testing, callbacks, security, plugins and go-live steps.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/featured-07-mpesa-integration.jpg\",\"contentUrl\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/featured-07-mpesa-integration.jpg\",\"width\":1200,\"height\":630,\"caption\":\"How to integrate M-Pesa into your business website\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/how-to-integrate-mpesa-into-your-business-website\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Integrate M-Pesa into Your Business Website\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/\",\"name\":\"Ace Solution Africa Ltd\",\"description\":\"Jump-start your digital presence\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/#organization\",\"name\":\"Ace Solution Africa Ltd\",\"url\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/logo.png\",\"width\":300,\"height\":86,\"caption\":\"Ace Solution Africa Ltd\"},\"image\":{\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/web.facebook.com\\\/AceSolutionAfricaLtd\\\/\",\"https:\\\/\\\/x.com\\\/AceSolutionAf\",\"https:\\\/\\\/www.instagram.com\\\/acesolutionafrica\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/ace-solution-africa-ltd\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/#\\\/schema\\\/person\\\/5b37502979f30e19194f9aff2b4a493e\",\"name\":\"Mutari Diawara\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c4309aae41b9323ae02f5a1c848ab9ad29aec1c11ec59ca3d747c46f471e3241?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c4309aae41b9323ae02f5a1c848ab9ad29aec1c11ec59ca3d747c46f471e3241?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c4309aae41b9323ae02f5a1c848ab9ad29aec1c11ec59ca3d747c46f471e3241?s=96&d=mm&r=g\",\"caption\":\"Mutari Diawara\"},\"sameAs\":[\"http:\\\/\\\/www.acesolutionafrica.com\"],\"url\":\"https:\\\/\\\/www.acesolutionafrica.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Integrate M-Pesa into Your Business Website (Step-by-Step Guide)","description":"Learn how to integrate M-Pesa into your website in Kenya: Daraja API, STK Push, Paybill vs Till, sandbox testing, callbacks, security, plugins and go-live steps.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/","og_locale":"en_US","og_type":"article","og_title":"How to Integrate M-Pesa into Your Business Website (Step-by-Step Guide)","og_description":"Learn how to integrate M-Pesa into your website in Kenya: Daraja API, STK Push, Paybill vs Till, sandbox testing, callbacks, security, plugins and go-live steps.","og_url":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/","og_site_name":"Ace Solution Africa Ltd","article_publisher":"https:\/\/web.facebook.com\/AceSolutionAfricaLtd\/","article_published_time":"2026-11-23T07:04:56+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/featured-07-mpesa-integration.jpg","type":"image\/jpeg"}],"author":"Mutari Diawara","twitter_card":"summary_large_image","twitter_creator":"@AceSolutionAf","twitter_site":"@AceSolutionAf","twitter_misc":{"Written by":"Mutari Diawara","Est. reading time":"24 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/#article","isPartOf":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/"},"author":{"name":"Mutari Diawara","@id":"https:\/\/www.acesolutionafrica.com\/blog\/#\/schema\/person\/5b37502979f30e19194f9aff2b4a493e"},"headline":"How to Integrate M-Pesa into Your Business Website","datePublished":"2026-11-23T07:04:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/"},"wordCount":4476,"publisher":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/#primaryimage"},"thumbnailUrl":"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/featured-07-mpesa-integration.jpg","keywords":["Daraja API","M-Pesa","payment integration","STK Push"],"articleSection":["Ecommerce","Payments"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/","url":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/","name":"How to Integrate M-Pesa into Your Business Website (Step-by-Step Guide)","isPartOf":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/#primaryimage"},"image":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/#primaryimage"},"thumbnailUrl":"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/featured-07-mpesa-integration.jpg","datePublished":"2026-11-23T07:04:56+00:00","description":"Learn how to integrate M-Pesa into your website in Kenya: Daraja API, STK Push, Paybill vs Till, sandbox testing, callbacks, security, plugins and go-live steps.","breadcrumb":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/#primaryimage","url":"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/featured-07-mpesa-integration.jpg","contentUrl":"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2026\/11\/featured-07-mpesa-integration.jpg","width":1200,"height":630,"caption":"How to integrate M-Pesa into your business website"},{"@type":"BreadcrumbList","@id":"https:\/\/www.acesolutionafrica.com\/blog\/how-to-integrate-mpesa-into-your-business-website\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.acesolutionafrica.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Integrate M-Pesa into Your Business Website"}]},{"@type":"WebSite","@id":"https:\/\/www.acesolutionafrica.com\/blog\/#website","url":"https:\/\/www.acesolutionafrica.com\/blog\/","name":"Ace Solution Africa Ltd","description":"Jump-start your digital presence","publisher":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.acesolutionafrica.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.acesolutionafrica.com\/blog\/#organization","name":"Ace Solution Africa Ltd","url":"https:\/\/www.acesolutionafrica.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.acesolutionafrica.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2021\/10\/logo.png","contentUrl":"https:\/\/www.acesolutionafrica.com\/blog\/wp-content\/uploads\/2021\/10\/logo.png","width":300,"height":86,"caption":"Ace Solution Africa Ltd"},"image":{"@id":"https:\/\/www.acesolutionafrica.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/web.facebook.com\/AceSolutionAfricaLtd\/","https:\/\/x.com\/AceSolutionAf","https:\/\/www.instagram.com\/acesolutionafrica\/","https:\/\/www.linkedin.com\/company\/ace-solution-africa-ltd"]},{"@type":"Person","@id":"https:\/\/www.acesolutionafrica.com\/blog\/#\/schema\/person\/5b37502979f30e19194f9aff2b4a493e","name":"Mutari Diawara","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c4309aae41b9323ae02f5a1c848ab9ad29aec1c11ec59ca3d747c46f471e3241?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c4309aae41b9323ae02f5a1c848ab9ad29aec1c11ec59ca3d747c46f471e3241?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c4309aae41b9323ae02f5a1c848ab9ad29aec1c11ec59ca3d747c46f471e3241?s=96&d=mm&r=g","caption":"Mutari Diawara"},"sameAs":["http:\/\/www.acesolutionafrica.com"],"url":"https:\/\/www.acesolutionafrica.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/posts\/3084","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/comments?post=3084"}],"version-history":[{"count":1,"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/posts\/3084\/revisions"}],"predecessor-version":[{"id":3091,"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/posts\/3084\/revisions\/3091"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/media\/3083"}],"wp:attachment":[{"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/media?parent=3084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/categories?post=3084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.acesolutionafrica.com\/blog\/wp-json\/wp\/v2\/tags?post=3084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}