PHP code example of mam-laka / payment-sdk

1. Go to this page and download the library: Download mam-laka/payment-sdk 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/ */

    

mam-laka / payment-sdk example snippets


$api = new MamlakaAPI('production');
$response1 = $api->getToken('username', 'password');
if(!$response1['error']){
    $response = $api->initiateMobilePayment(
        'merchantid',
        'KES',
        1.0,
        '254768899729',
        'M-Pesa',
        'externalId3',
        'https://b8ca-217-21-116-242.ngrok-free.app'
    );
    print_r($response);
} else {
    echo "Authentication failed
";
}

$response = $api->getToken('username', 'password');

$response = $api->initiateMobilePayment(
    'merchantid',
    'KES',
    1.0,
    '254768899729',
    'M-Pesa',
    'externalId',
    'https://b8ca-217-21-116-242.ngrok-free.app'
);