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.
- User Guide – For both getting started and in-depth SDK usage information
- API Docs – For details about operations, parameters, and responses
- Blog – Tips & tricks, articles, and announcements
- Sample Project - A quick, sample project to help get you started
- Issues – Report issues, submit pull requests, and get involved
- @openpesa – Follow us on Twitter
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 [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.