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 …