1. Go to this page and download the library: Download pasisltd/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/ */
pasisltd / php-sdk example snippets
asis\SDK\Client;
// Create a new client with your app credentials
$client = new Client('your-app-key', 'your-secret-key');
// Get wallet details
$wallet = $client->wallet();
echo "Wallet ID: {$wallet->id}\n";
// Get merchant profile
$profile = $client->profile();
echo "Merchant: {$profile->firstName} {$profile->lastName}\n";
// Good: Create once, reuse everywhere
class MyService
{
private Client $client;
public function __construct()
{
$this->client = new Client('app-key', 'secret-key');
}
public function handleRequest()
{
$wallet = $this->client->wallet();
// ...
}
}
use GuzzleHttp\Client as HttpClient;
$httpClient = new HttpClient([
'timeout' => 30.0,
'connect_timeout' => 10.0,
]);
$client = new Client(
'app-key',
'secret-key',
[
'httpClient' => $httpClient,
]
);
try {
$result = $client->wallet();
} catch (APIError $e) {
// Handle API errors
if ($e->statusCode >= 500) {
// Server error - might want to retry
} elseif ($e->statusCode >= 400) {
// Client error - fix the request
}
} catch (\Exception $e) {
// Handle other errors
}
class PaymentService
{
public function __construct(private Client $client)
{
}
public function processPayment(float $amount): void
{
$request = new DepositRequest(
(string)$amount,
'USD',
'mobile_money',
'US'
);
$transaction = $this->client->deposit($request);
// Process transaction...
}
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.