MPESA stk-push intergration with dashboard to enable admin/supersuer to view all payments made.
The project uses Tailwindcss for styling the web pages,
-
To Set up the project clone or fork the repository
git clone <repo>
-
Set up the environment variables.
-
Inside the project directory locate the
settings.py
file. -
In the same directory as
settings.py
, create an env file.env
.
.env SECRET_KEY=<secret_key> # your secret key MPESA_PASSKEY=<Mpesa passkey> # obtained from Mpesa daraja Portal MPESA_BUSINESS_NUMBER=12345 # Business Number provided by MPESA DARAJA API for testing MPESA_SHORTCODE=174379 #Shortcode also provided by MPESA DARAJA API for testing CONSUMER_KEY=<consumer_key> # consumer key provided by MPESA DARAJA API for testing CONSUMER_SECRET=<consumer_secret> #consumer secret also provided by MPESA DARAJA API for testing MPESA_API_ENDPOINT=https://sandbox.safaricom.co.ke/ MPESA_CALLBACK_URL=<callback_url> # for localhost you can use ngrok
-
-
Create virtual environment
python3 -m venv <name_of_your_virtualenvirnment>
-
Install dependencies.
- To install the dependencies, navigate to project root directory and open terminal.
pip install -r requirements.txt
-
Run the Migrations.
- You can set your own database. For this project we are using
sqlite
python3 manage.py migrate
- You can set your own database. For this project we are using
-
The finnaly run the server.
npm run tailwind-watch python3 manage.py runserver
-
Create a super user or admin user with email and password.
- Admin user can view all the payments when logged in to the application.
python3 manage.py createsuperuer
-
Visit
http://localhost:8000/
to view on the browser.http://localhost:8000/
-
Register a user on regiter user page.
-
Login then make payment form your safaricom phone.
-
Logout and login again as a
superuser
oradmin
to view the payment list.
-