We have integrated Mpesa API on Moodle websites before and we can do it again and again on your Moodle websites. In this post, I will let you know how we have integrated Mpesa payments/enrolments on Moodle website and how we can assist you add Mpesa on your Moodle websites.

Let us dive in.

What will this solution help you in?

Mpesa API integration will help your Moodle website users make payments via Mpesa and get automatically enrolled for specific courses after payments hit your Mpesa Till number or Paybill.

Below is an illustration of how this Mpesa enrolment moodle payment method works:


Mpesa API integration on Moodle

Fig 1: Shows Mpesa as one of the methods presented an enrolment method for a specific Moodle leaning material or course.

In the above images, you can easily see the Mpesa payment gateway will be listed as one of the payment methods to be used to make payment for this course. This will appear alongside other payment methods activated for this course.

After entering the Mpesa number in the provided field, the following page will display listening to the Mpesa payment. At the same time, an stk push (Mpesa POP form) will appear on the customer mobile phone as shown on figure 3 below. The customer will just input their Mpesa pin and the process is completed automatically enrolling the customer to that specific course.


 adding Mpesa payment on Moodle

Fig 2: An illustration of the fallback page listing for Mpesa payment from the customer's Mpesa number.

adding Mpesa payment on Moodle


Fig 3: An illustration of the Mpesa STK push as it appears on the clients' Mpesa phone asking for payment.


After the above step, the user will be automatically subscribed the course.


Moodle Mpesa enrolment plugin setup.


The Mpesa enrolment plugin is installed and setup like any other Moodle enrolment plugin. Follow the below illustrations to understand how to setup this plugin.

adding Mpesa payment on Moodle

Fig 4: The Mpesa enrolment plugin is known as mbikipay. Therefore, once installed an activated, it will be available under each course ready to be setup as an enrolment method.

adding Mpesa payment on Moodle


Fig 5: Filling in the details and labeling the specific gateway name for this course. Look at the Custom, instance name. I named it as Lipa na Mpesa and it is the one which customers will see when trying to make payment for a certain moodle course.

 adding Mpesa payment on Moodle

 Fig 6: Perfect. The Lipa na Mpesa enrolment method is now set and is active on this course. You need to set it on each course where you want customers to use Mpesa payments to enrol. That is the way Moodle works.