- Clone the repository
git clone https://github.com/wathika-eng/mpesa_example_python --depth 1 && cd mpesa_example_python
- Activate virtualenv and nstall the dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
- 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"
- Run the application
python mpesa.py