This is the latest simplified way to embed Mpesa payments for Mozambique in your Laravel app. And this is an improvement from past integrations already tested.
I consider it essential to read a little more about the working principle of this SDK, accessing the following link: VM - Developer Portal
First consider important/mandatory that your project fulfills the following requirements, required for the execution of this package
composer create-project laravel/laravel:^8.0 example-app
composer require nakatsinho/mpesa-laravel
php artisan mpesa-sdk:publish
Now we have the basics to test! Note that the command above brought us the following files:
Be sure to get and set your files like those following:
<?php
return [
'public_key' => env('MPESA_PUBLIC_KEY'),
'api_host' => env('MPESA_API_HOST'),
'api_key' => env('MPESA_API_KEY'),
'origin' => env('MPESA_ORIGIN'),
'service_provider_code' => env('MPESA_SERVICE_PROVIDER_CODE'),
'initiator_identifier' => env('MPESA_INITIATOR_IDENTIFIER'),
'security_credential' => env('MPESA_SECURITY_CREDENTIAL')
];
MPESA_PUBLIC_KEY="XXX XXXXXX XXXXXX" - You will obtain this on VM Portal
MPESA_API_HOST="api.sandbox.vm.co.mz" - Leave it
MPESA_API_KEY="XXX XXXXXX XXXXXX" - You will obtain this on VM Portal
MPESA_ORIGIN="XXX XXXXXX XXXXXX" - You will obtain this on VM Portal
MPESA_SERVICE_PROVIDER_CODE=(Random 6 digits)
MPESA_INITIATOR_IDENTIFIER="XXXXX XXX XXXXX"
MPESA_SECURITY_CREDENTIAL="XXXX XXXX XXXX"
After that, go to you routes/web.php file and place this
Route::resource('payment',PaymentController::class);
Just type this on you terminal:
php -S localhost:8030 -t public/
Open you Browser, and type http://127.0.0.1:8030/payment !!! ENJOY...
It would be great to receive criticisms and new suggestions as a way to help improve this package, which is still under development! And my credits go to abdulmuied, responsible for building the main SDK in PhP...
Powered by Kelton Mauro Cumbe 🇲🇿, aka The Problems Solver ! WhatsApp me any time .
Share and help me to improve... (stable version coming soon)