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.jsonfile with your credentials from Daraja dashboard. -
Install daraja with
pip install daraja -
Import the
mpesamodule fromdarajalike 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file daraja-0.0.4.tar.gz.
File metadata
- Download URL: daraja-0.0.4.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c89fafb6a2c93cb91d9b35937b08a14092dba200c60dd8f966fef5699f057764
|
|
| MD5 |
9734a72c40def1e904a176599280e809
|
|
| BLAKE2b-256 |
737f310938b5310ab8e61f40235b3779f8e0fe3213a309ac1d36381551f8babf
|
File details
Details for the file daraja-0.0.4-py3-none-any.whl.
File metadata
- Download URL: daraja-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88858eeed4df2ad4a8882697de7db86e3344fc8363563274a18ba98a0e7a33d1
|
|
| MD5 |
b40f6e9d1c35243e32d61a8b38f32abc
|
|
| BLAKE2b-256 |
100e13ac34abdf802285587806177c5e7c705415096c7df89c326dbbfc636a28
|