PHP code example of silahkosgei / mpesa
1. Go to this page and download the library: Download silahkosgei/mpesa library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
silahkosgei / mpesa example snippets
use SilahKosgei\Mpesa\Mpesa;
$mpesa = new Mpesa();
$response = $mpesa->initiateStkPush(
'254712345678', // phone
100, // amount
'ORDER-12345', // account reference
'Payment for Order #12345', // description
12345 // reference ID for callback
);
$response = $mpesa->lookupPayment('ws_CO_123456789');
bash
php artisan vendor:publish --tag=mpesa-config