Version 2 | Work in Progress π§
The Pesa SDK for PHP makes it easy for developers to access OpenAPI in their PHP code, and build robust applications and software using services like Customber 2 Bussiness, Query etc.
Take a look at the API docs here.
Sign up for OpenAPI Portal β Before you begin, you need to sign up for an account and retrieve your credentials.
Minimum requirements β To run the SDK, your system will need to meet the minimum requirements, including having PHP >= 7.1.
Install the SDK β Using [Composer] is the recommended way to install the
Pesa SDK for PHP. The SDK is available via [Packagist] under the
openpesa/php-pesa
package. If Composer is installed globally on your system, you can run the following in the base directory of your project to add the SDK as a dependency:
composer require openpesa/pesa
Please see the Installation section of the User Guide for more detailed information about installing the SDK through Composer and other means.
Using the SDK β The best way to become familiar with how to use the SDK is to read the User Guide.
require 'vendor/autoload.php';
use Openpesa\SDK\Pesa;
// Intiate with credentials
$pesa = new Pesa([
'api_key' => 'YOUR_API_KEY',
'public_key' => 'PUBLIC_KEY',
'client_options' => [],
],'sandbox');
// Setup the transaction
$data = [
'input_Amount' => '10000',
'input_Country' => 'TZN',
'input_Currency' => 'TZS',
'input_CustomerMSISDN' => '255766303775',
'input_ServiceProviderCode' => '000000',
'input_ThirdPartyConversationID' => 'rerekf',
'input_TransactionReference' => rand(),
'input_PurchasedItemsDesc' => 'Test Two Item'
];
// Execute
$result = $pesa->c2b($data);
// Print results
var_dump($result);
For more example check pesa-demo-example.
composer test
If you have a feature requrest or you encounter a bug, please file an issue on our issue tracker on GitHub.
Please see CHANGELOG for more information what has changed recently.
Please review our CONTRIBUTING for details.
If you discover any security related issues, please email alphaolomi@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.