Payment Plugins

How to integrate Mpesa Payments or enrolments on a Moodle website

This is a guide on how to integrate Mpesa Payments or enrolments on a Moodle website. Let me make you smile; this is a very easy to follow guide if you have prior knowledge on how mpesa works and the moodle LMS. The immediate below is a guide on the steps. However, let me first define key terminologies.
Mpesa moodle plugin demo Buy Mpesa moodle plugin

Definition of key terminologies related to Mpesa, Moodle and API integration.

  1. Mpesa : A mobile money payment gateway operated by Safaricom in Kenya and Vodacom in other countries.
  2. Moodle: A php based Learning Management system used to create online learning websites.
  3. API integration: The process of using an application programing interface to connect a software or all like Moodle website to Mpesa or any other software. In our current case, it is a bridge code developed by a Mpesa software developer between Mpesa and Moodle websites which helps people pay and automatically get enrolled on a course using the Mpesa mobile money.

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.

A close look at the above steps, you will notice that it is easy to plug in an Mpesa Payment gateway on your Moode websites. All you simply need is our Mpesa moodle payment plugin and then setup using the Mpesa and Daraja API credentials as follows:

  1. Consumer Key and consumer secret from Daraja
  2. Mpesa paybill registered from a safaricom shop
  3. Passkey sent by safaricom when you Go Live on Daraja

Summarized list of How to Integrate Mpesa to Moodle LMS website

Plugin or Mpesa API/Daraja credentials Source How to get
Moodle mpesa plugin Download or contact +254706745202
Paybill number Safaricom shop Apply at a safaricom shop
Consumer key Go Live on Daraja
Consumer secret Go live on Daraja to get
Passkey or password Safaricom email On Going live on Daraja
Technical support Via phone or whatsapp Contact us on +254706745202

With the above details, you are good to go. If these appear as too technical and complicated, just get in touch with us and we will help you get all of them from safaricom.