This is a simple Mpesa Lipa Online STK push API implementation Blog on GeekTalkThursday
Git clone and Run Composer
composer install
Create .env
file
cp .env.example .env
Generate Key
php artisan key:generate
For the staging environment, you can use the already gibe sandbox Short Code and Passkey, you'll only need to generate the Consumer Key and Secret from the Daraja sandbox For Production , you'll have to provide the Short Code and Pass Key
MPESA_SHORT_CODE=
MPESA_PASSKEY=
CONSUMER_KEY=
CONSUMER_SECRET=
php artisan serve
For the API callback to be hit from Mpesa , you must use a live server , or use Ngrok in order to expose your local server (localhost)
Remember to replace the env APP_URL
with the generated Ngrok URL
The Laravel framework is open-sourced software licensed under the MIT license.