
Product
Introducing Reachability for PHP
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.
django-mpesa
Advanced tools
Django-Mpesa is a generic python library that interfaces the safaricom MPESA APIs to enable easy payments to your python application.
Detailed documentation is in the "docs" directory.
View the module from the official pypi site <https://pypi.org/project/django-mpesa/>__
Install the package with pip like this::
pip install django-mpesa
Add "mpesa" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ ... 'mpesa', ]
Add Mpesa Config variables to your project's settings.py file
MPESA_CONFIG = { ... 'CONSUMER_KEY': '', 'CONSUMER_SECRET': '', 'HOST_NAME': '<Your hostname e.g https://myhostname>', 'PASS_KEY': '', 'SAFARICOM_API': 'https://sandbox.safaricom.co.ke', 'SHORT_CODE': '174379'
}
Check below for full setting variables description
Include the polls URLconf in your project urls.py like this::
from django.urls import path, include from mpesa.urls import mpesa_urls
path('mpesa/', include(mpesa_urls)),
Run python manage.py migrate to create the mpesa models.
Start the development server and visit http://127.0.0.1:8000/admin/
Visit http://127.0.0.1:8000/mpesa/ to checkout the library features.
This module exposes some API endpoints that enable you work with MPESA API
mpesa/submit/ This endpoint allows you to submit a post request to initiate an STK push
mpesa/confirm/ This endpoint is used as the callback endpoint on which MPESA will return a transaction response/status
mpesa/check-transaction/ This endpoint allows you to manually check for the status of an mpesa transaction
Check out the test module <https://github.com/Ekirapapaul/django-mpesa/tree/master/tests>__ for more elaborate examples
FAQs
A python library that interfaces safaricoms mpesa apis
We found that django-mpesa demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.

Product
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.

Research
/Security News
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.