This repository contains a Django-based web application that integrates with the M-Pesa API to initiate payment prompts via STK Push.
# πΈ M-Pesa Prompt Integration
This repository contains a Django-based web application that integrates with the **M-Pesa API** to initiate payment prompts via **STK Push**.
---
## π Features
- **π² STK Push Integration** β Sends payment prompts directly to users' mobile devices via M-Pesa.
- **π§± Django Framework** β Rapid backend development with a clean structure.
- **π SQLite Database** β Lightweight local database for transactions.
---
## ποΈ Project Structure
mpesa-prompt/
β
βββ mpesademo/ # Django project configuration
βββ myapp/ # Core logic for M-Pesa integration
βββ db.sqlite3 # SQLite database
βββ manage.py # Django management utility
βββ .env # Environment variables (not tracked in Git)
βββ requirements.txt # Python dependencies
---
## βοΈ Technologies Used
- **Python** β Backend language
- **Django** β Web framework
- **SQLite** β Development database
---
## π§ͺ Getting Started
### β
Prerequisites
- Python 3.x installed
- Optional: Virtual environment tool
---
### π§ Installation
1. **Clone the Repository**
```bash
git clone
github.com
cd mpesa-prompt
```
Create and Activate a Virtual Environment (Optional)
macOS/Linux:
bash
Copy
Edit
python -m venv venv
source venv/bin/activate
Windows:
bash
Copy
Edit
python -m venv venv
venv\Scripts\activate
Install Dependencies
bash
Copy
Edit
pip install -r requirements.txt
Configure Environment Variables
Create a .env file in the root directory and add:
env
Copy
Edit
CONSUMER_KEY=your_consumer_key
CONSUMER_SECRET=your_consumer_secret
SHORTCODE=your_shortcode
PASSKEY=your_passkey
Apply Migrations
bash
Copy
Edit
python manage.py migrate
Run the Server
bash
Copy
Edit
python manage.py runserver
Open your browser at:
π
localhost
πΌ Usage
Navigate to the homepage.
Enter payment details.
Submit the form to initiate an STK Push request to the provided phone number.
π€ Contributing
Contributions are welcome!
To contribute:
Fork this repository.
Create β¦