A python library that interfaces safaricoms mpesa apis
Project description
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
Quick start
Install the package with pip like this:
pip install django-mpesa
Add “mpesa” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'mpesa', ]
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 makemigrations and 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.
API ENDPONTS
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/checktransaction/
- This endpoint allows you to manually check for the status of an mpesa transaction
Check out the test module for more elaborate examples
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size django_mpesa-1.3.4-py3-none-any.whl (12.8 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size django-mpesa-1.3.4.tar.gz (8.4 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for django_mpesa-1.3.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 620745c03a4e5d6d1113374d0aef6cfdad63ac04f427ef0bf4a64c19660c371e |
|
MD5 | 7b43cc170dfcc3edc0f3e593518a7b07 |
|
BLAKE2-256 | 02bc1e6961579388de5d6988738153f3816c834a9dc76e040636fd9d99689d9f |