# Daraja 2.0 STK Push Integration π
A complete and functional implementation of Safaricom's Daraja 2.0 STK Push API using PHP, MySQL, and Bootstrap.
## π Features
- Collects mobile number and amount via a web form
- Sends STK Push requests to M-Pesa using the Daraja API
- Automatically creates database and table if they don't exist
- Saves payment requests and callbacks to MySQL database
- Logs callback data for transaction confirmation
- Fully responsive UI with error handling
- Automatic phone number formatting (supports 254 and 0 formats)
- Dynamic callback URL detection
## π Quick Deploy to Render (Recommended)
This app is configured for deployment on Render. **See
github.com for detailed instructions.**
### Quick Steps:
1. Push code to GitHub
2. Deploy to Render (free tier available)
3. Set environment variables in Render dashboard
4. Get your public URL (auto-configured for callbacks)
5. Test your M-Pesa integration
**π Full Render Deployment Guide**
## π Local Development Setup
### Prerequisites
- PHP 7.4 or higher
- MySQL/MariaDB
- XAMPP/WAMP (for local development)
- M-Pesa Daraja API credentials (sandbox or production)
- **Note**: For M-Pesa callbacks, you need a publicly accessible URL. Deploy to Render for testing.
### Installation
1. **Clone or download this repository**
```bash
git clone
cd mpesa_project
```
2. **Configure Database**
- Update `
github.com` with your database credentials
- Or run `
github.com` in your browser
- Or import `
github.com` manually
3. **Configure M-Pesa Credentials**
- Update `
github.com β¦