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!

PAYE Tax Calculator

Popular Posts
01
Mombasa postal code 80100

Mombasa postal code 80100

Getting Started
02
Top Tea Manufacturers and Factories in Kenya: Specialty Teas, Locations, and Contacts

Top Tea Manufacturers and Factories in Kenya: Specialty Teas, Locations, and Contacts

Getting Started
03
Indemnity Insurance: Providers and Types

Indemnity Insurance: Providers and Types

Getting Started
04
KUSCCO Faces Sh12.5 Billion Loss: Ministry of Cooperatives to Investigate Financial Mismanagement

KUSCCO Faces Sh12.5 Billion Loss: Ministry of Cooperatives to Investigate Financial Mismanagement

Getting Started
05
Top 10 Must-Read Romantic Novels to Set Your Heart Aflutter

Top 10 Must-Read Romantic Novels to Set Your Heart Aflutter

Getting Started
06
Inorganic vs Organic Chemicals in Fertilizers: A Guide for Farmers

Inorganic vs Organic Chemicals in Fertilizers: A Guide for Farmers

Getting Started