You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

daraja

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

daraja

A simple to use payments module around the Mpesa Daraja API


Maintainers
1

Readme

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.

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc