Skip to content

GeeksTalk/mpesa_stk_api_laravel

Repository files navigation

About This Project

This is a simple Mpesa Lipa Online STK push API implementation Blog on GeekTalkThursday

Configuring

Git clone and Run Composer

composer install

Create .env file

cp .env.example .env

Generate Key

php artisan key:generate

Set Up .env variables

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=

Running

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

Licence

The Laravel framework is open-sourced software licensed under the MIT license.