A simple to use payments module around the Mpesa Daraja API
Project description
Daraja - Easy to use wrapper around M-Pesa Daraja API
This module provides functions around the Mpesa Daraja API to simplify the whole integration process(problem).
This is what you need to do to get things running:
-
Fill out the
config.json
file with your credentials from Daraja dashboard. -
Install daraja with
pip install daraja
-
Import the
mpesa
module fromdaraja
like so:
from daraja import Mpesa
- Instantiate a Mpesa object with only two parameters, the config.json file and your environment(either "dev" or "prod"); dev being a development environment and prod being a production environment. This value is used to determine the API endpoints that will be used.
...
mpesa = Mpesa(config_file="config.json", env="prod")
- Use the Mpesa object to do stuff, like so:
...
response = mpesa.stk(receiver="254791500264", amount=50)
print(response)
I am working on extending this to cover all the remaining features the Daraja API has to offer. If you can help with it, contact me.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
daraja-0.0.4.tar.gz
(3.9 kB
view hashes)
Built Distribution
daraja-0.0.4-py3-none-any.whl
(3.7 kB
view hashes)