Skip to main content

A simple to use payments module around the Mpesa Daraja API

Project description

Daraja - Easy to use wrapper around M-Pesa Daraja API

PyPI version

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:

  1. Fill out the config.json file with your credentials from Daraja dashboard.

  2. Install daraja with pip install daraja

  3. Import the mpesa module from daraja like so:

from daraja import Mpesa
  1. 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")
  1. 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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

daraja-0.0.4-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

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

Hashes for daraja-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c89fafb6a2c93cb91d9b35937b08a14092dba200c60dd8f966fef5699f057764
MD5 9734a72c40def1e904a176599280e809
BLAKE2b-256 737f310938b5310ab8e61f40235b3779f8e0fe3213a309ac1d36381551f8babf

See more details on using hashes here.

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

Hashes for daraja-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 88858eeed4df2ad4a8882697de7db86e3344fc8363563274a18ba98a0e7a33d1
MD5 b40f6e9d1c35243e32d61a8b38f32abc
BLAKE2b-256 100e13ac34abdf802285587806177c5e7c705415096c7df89c326dbbfc636a28

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page