Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 870 Bytes

README.md

File metadata and controls

43 lines (29 loc) · 870 Bytes

Getting started

  1. Clone the repository
git clone https://github.com/wathika-eng/mpesa_example_python --depth 1 && cd mpesa_example_python
  1. Activate virtualenv and nstall the dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
  1. Copy and update the environment variables
cp .env.example .env

On line 254 in mpesa.py after main() function, replace phone number with your phone number.

    try:
        mpesa_client = MPesaClient()

        # Example transaction, change as needed
        phone_number = "254746554245"
  1. Run the application
python mpesa.py

Sample output

Response: image

Logs: sampleLogs