Integrating MPESA STK Push Payments on Your WooCommerce WordPress Website

2 min read

How to Accept MPESA Payments on Your WooCommerce WordPress Website

Integrating WooCommerce MPESA Payment

We’ve previously explored how to integrate MPESA into custom PHP and Laravel websites. Now, let’s focus on integrating MPESA STK Push into a WooCommerce WordPress website using a plugin.

Step 1: Set up the MPESA App on Safaricom Daraja Portal

Before setting up the WooCommerce MPESA plugin on your e-commerce website, you need to configure the MPESA app on the Safaricom Daraja Portal. Here’s how:

  1. Create a new sandbox app:
    • Log into the Daraja Portal.
    • Click Add a New App and name your app.
    • Select Lipa na MPESA Sandbox and MPESA Sandbox.
    • Click Create App.
    • After creating the app, copy the Consumer Key and Consumer Secret. You’ll need them during integration.

Step 2: Installing WooCommerce

To accept payments, your WordPress site must have the WooCommerce plugin installed. Follow these steps:

  1. Navigate to Plugins on your WordPress dashboard.
  2. Click Add New.
  3. In the search bar, type WooCommerce.
  4. Install the plugin by Automattic by clicking Install Now.
  5. Once installed, click Activate Now.

Step 3: Installing WooCommerce MPESA Payment Plugin

With WooCommerce set up, you can now add the MPESA payment gateway.

  1. Download the WooCommerce MPESA Payment Plugin:

    • Go to a trusted MPESA plugin provider or this page.
    • Click Download.
  2. Install the Plugin:

    • On your WordPress dashboard, go to Plugins > Add New > Upload Plugin.
    • Upload the plugin file, then click Install Now.
    • Activate the plugin.
  3. Configure the MPESA Payment Gateway:

    • Go to WooCommerce > Settings.
    • Select the Payments tab, then click MPESA.

Step 4: Fill in Your App and Business Details

To set up the MPESA payment gateway, complete the following fields:

  • Environment: Choose Sandbox for testing or Live for real transactions.
  • Identifier Type: Select either Till number or Paybill.
  • Business Shortcode: Enter your business Paybill or Till number.
  • Account Reference: Set your account reference (store ID or order ID).
  • Consumer Key: Paste the Consumer Key from the Daraja Portal.
  • Consumer Secret: Paste the Consumer Secret.
  • Online Pass Key: Enter the pass key for MPESA.

Step 5: Test the STK Push

Once your setup is complete, you can test the MPESA payment process.

  1. Place a test order on your WooCommerce store.
  2. At checkout, select MPESA as the payment method.
  3. Enter your phone number, and an STK Push will be triggered on the phone.
  4. Enter your MPESA PIN to complete the payment.

If successful, the transaction will be marked as paid, and you can proceed with the order fulfillment.

Conclusion

By following these steps, you can seamlessly integrate MPESA STK Push payments into your WooCommerce WordPress website, offering customers a secure and convenient way to pay. Testing your setup in sandbox mode before going live ensures everything runs smoothly.

Thank you!

Popular Posts
01
Kiswahili vitendawili na majibu yake grade 1, 2, 3, 4, 5, 6 Book

Kiswahili vitendawili na majibu yake grade 1, 2, 3, 4, 5, 6 Book

Getting Started
02
Visa vs Mastercard vs American Express: Credit card or debit card Which Card is Best for You?

Visa vs Mastercard vs American Express: Credit card or debit card Which Card is Best for You?

Getting Started
03
Car Battery at The Best Price in Kenya

Car Battery at The Best Price in Kenya

Getting Started
04
List of Best Maternity Hospitals in Kenya

List of Best Maternity Hospitals in Kenya

Getting Started
05
When to sell my books

When to sell my books

Getting Started
06
Maternity Pants, Nursery Bras, Baby Shower Dresses, Breastfeeding Bras, Pregnancy Workout Gear: Best Shops and Prices in Kenya

Maternity Pants, Nursery Bras, Baby Shower Dresses, Breastfeeding Bras, Pregnancy Workout Gear: Best Shops and Prices in Kenya

Getting Started