A Shopify store can take M-Pesa, but M-Pesa does not work on Shopify out of the box. Shopify has no native M-Pesa gateway, so the payment has to be connected through Safaricom's Daraja API. The difference between a proper integration and a bolted-on payment link is the difference between a checkout customers finish and one they abandon at the last step.

How should M-Pesa payments work on a Shopify checkout?

M-Pesa on a Shopify checkout should use STK Push, so the PIN prompt appears on the customer's phone with the correct amount already filled in. The customer taps pay, enters their M-Pesa PIN and the order completes.

The weaker alternative prints a Till number on the checkout and asks the customer to leave the site, open the M-Pesa menu, choose Lipa na M-Pesa, type the Till number, type the amount and come back. Many customers simply do not come back. Both versions get described as "M-Pesa on Shopify", but only the STK Push version is a checkout.

Technically, an STK Push integration sends a request to Daraja's M-Pesa Express endpoint with the order total and the customer's phone number, using the transaction type CustomerPayBillOnline for a paybill or CustomerBuyGoodsOnline for a till. The request is triggered from the checkout itself, not from a separate page.

How does Shopify know an M-Pesa payment has gone through?

Shopify only knows an M-Pesa payment has succeeded if the integration tells it. Daraja sends a confirmation to a callback URL, and the callback has to mark the Shopify order paid with the M-Pesa receipt number attached.

Payment reconciliation is where most M-Pesa builds break, and the problem is invisible on launch day. A payment can succeed on the customer's phone while the Shopify order stays unpaid, because nothing reported it back. Where that step is missing, someone has to match payments to orders by hand every evening, which is where errors, double shipments and refund requests come from, and the workload grows as the store gets busier.

Two details are worth insisting on:

  • Store the M-Pesa receipt number on the Shopify order. Without the receipt number, a payment dispute three weeks later cannot be resolved.
  • Make the callback idempotent. Daraja can deliver the same confirmation more than once, and a callback that marks an order paid twice will eventually create a duplicate.

What happens when an M-Pesa payment fails on Shopify?

When an M-Pesa payment fails, the checkout should return the customer to a cart that still holds their items and offer a clear next step. The successful path is a small part of the work; failure handling is most of it.

What happensWhat the checkout must do
The STK prompt times out unansweredReturn the customer to their cart with a retry option
The customer enters a wrong PINExplain what went wrong and offer a retry
The M-Pesa balance is too lowOffer a retry and the store's other payment methods
The customer pays twiceDetect the duplicate receipt and flag it instead of creating a second order
The callback never arrivesCheck the payment with Daraja's transaction status query

An M-Pesa integration that only handles the successful case looks fine in testing, because testing is where everything works. The same integration loses money in production.

What should you ask a developer building M-Pesa into Shopify?

Five questions separate a real M-Pesa integration from a payment link:

  • Does the PIN prompt appear on the customer's phone from inside the checkout?
  • Does a successful payment mark the Shopify order paid automatically, with the receipt number?
  • What happens if the payment confirmation arrives twice?
  • What does the customer see when the STK prompt times out?
  • How are a day's M-Pesa payments reconciled against a day's Shopify orders?

If the answer to the second question is "we check them manually", the store does not have an M-Pesa integration. The store has M-Pesa instructions.

Does this approach apply to mobile money outside Kenya?

The same approach applies to mobile money in other markets, even though the payment rail changes. Every market has payment methods that local shoppers expect and that a card-only checkout quietly filters out. What transfers is the discipline: confirm each payment back to the order automatically, store the payment reference, and handle failures deliberately. Shopify's own documentation explains how payment apps report outcomes to orders (Shopify payments apps).

Mooshfy will say plainly whether we have built on a given payment rail before or would be integrating it for the first time with you.

Frequently asked questions

Is there an official M-Pesa payment gateway for Shopify?

Shopify does not offer M-Pesa as a native payment gateway. M-Pesa is connected to a Shopify store through Safaricom's Daraja API, either with a payments app or a custom integration, and the integration has to report each payment back to the Shopify order.

What is M-Pesa STK Push?

M-Pesa STK Push (also called M-Pesa Express or Lipa na M-Pesa Online) is a Daraja API request that sends a payment prompt straight to the customer's phone with the amount pre-filled. The customer only enters their M-Pesa PIN to approve the payment (Safaricom Daraja).

Can a Shopify store offer M-Pesa alongside card payments?

Yes. M-Pesa can sit next to card payments, Shop Pay and other methods at checkout. Offering both matters, because a customer whose M-Pesa payment fails for a low balance should be able to finish the order with another method without starting again.

Cities in Kenya

See this page for a specific city in Kenya:

Mooshfy across markets

We build and grow Shopify stores worldwide. Explore this page for another market:

Want this done for you?

Tell us about your store in Kenya and we'll show you the fastest wins — free.