PHP code example of macdanson / jpesa-php-sdk
1. Go to this page and download the library: Download macdanson/jpesa-php-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/ */
macdanson / jpesa-php-sdk example snippets
use JPesa\SDK\JPesaClient;
$client = new JPesaClient(
baseUrl: 'https://my.jpesa.com/api/',
apiKey: getenv('JPESA_API_KEY') ?: 'YOUR_KEY'
);
// Credit
$res = $client->credit([
'mobile' => '256752567374',
'amount' => 1000,
'tx' => 'ORDER-12345',
]);
$client->debit([ 'mobile'=>'2567...', 'amount'=>500, 'tx'=>'PAYOUT-1' ]);
$client->transactionInfo([ 'tid'=>'TXN-ID-ABC' ]);
// or: $client->transactionInfo([ 'pid'=>'PAYMENT-ID-XYZ' ]);
// or: $client->transactionInfo([ 'cur'=>'UGX' ]);
$client->kyc('2567...');
use JPesa\SDK\JPesaClient;
public function charge(JPesaClient $jpesa) {
$jpesa->credit(['mobile'=>'2567...','amount'=>1000,'tx'=>'ORDER-1']);
}
use JPesa\SDK\Laravel\Facades\JPesa;
JPesa::debit(['mobile'=>'2567...','amount'=>500,'tx'=>'PAYOUT-1']);
bash
composer bash
php artisan vendor:publish --tag=config --provider="JPesa\SDK\Laravel\JPesaServiceProvider"