mam-laka / payment-sdk
A PHP SDK for processing payments with Mamlaka.
1.0.0
2025-01-12 17:25 UTC
Requires
- php: >=7.4
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is not auto-updated.
Last update: 2025-08-11 18:53:42 UTC
README
Mamlaka SDK is a PHP library for integrating with the Mamlaka API.
Installation
Install using Composer:
composer require mama-laka/payment-sdk
Usage
1. Set up the MamlakaAPI object and authenticate
$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 "; }
3. Example API Methods
3.1. getToken
Authenticate and get the token:
$response = $api->getToken('username', 'password');
3.2. initiateMobilePayment
Initiate a mobile payment:
$response = $api->initiateMobilePayment( 'merchantid', 'KES', 1.0, '254768899729', 'M-Pesa', 'externalId', 'https://b8ca-217-21-116-242.ngrok-free.app' );
License
This project is licensed under the MIT License - see the LICENSE file for details.