PHP code example of seerbit / seerbit-php-sdk
1. Go to this page and download the library: Download seerbit/seerbit-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/ */
seerbit / seerbit-php-sdk example snippets
try{
$token = "YOUR MERCHANT TOKEN";
//Instantiate SeerBit Client
$client = new Client();
//Configure SeerBit Client
$client->setToken($token);
//SETUP CREDENTIALS
$client->setPublicKey("MERCHANT_PUBLIC_KEY"); //REQUIRED
$client->setSecretKey("MERCHANT_SECRET_KEY"); //OPTIONAL
//Instantiate Resource Service
$standard_service = New StandardService($client);
$uuid = bin2hex(random_bytes(6));
$transaction_ref = strtoupper(trim($uuid));
//the order of placement is important
$payload = [
"amount" => "1000",
"callbackUrl" => "http:yourwebsite.com",
"country" => "NG",
"currency" => "NGN",
"email" => "[email protected] ",
"paymentReference" => $transaction_ref,
"productDescription" => "product_description",
"productId" => "64310880-2708933-427",
"tokenize" => true //optional
];
$transaction = $standard_service->Initialize($payload);
echo($transaction->toJson());
}catch (\Exception $exception){
echo $exception->getMessage();
}
//Set Logger path
$client->setLoggerPath(dirname(__FILE__));
//Set custom Logger
$client->setLogger = $->CustomLoggerService();