seerbit / seerbit-php-sdk
SeerBit PHP Library
Installs: 3 193
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 3
Open Issues: 2
Requires
- php: ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- monolog/monolog: >=1.16
Requires (Dev)
- php-coveralls/php-coveralls: ^2.5
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.7
- symfony/process: ~6.2
README
SeerBit PHP Library
This library provides convenient access to the SeerBit API from PHP based applications. It provides Utility classses to access API resources on SeerBit.
Integration
The Library supports all APIs under the following services:
- Standard Checkout
- Payment via Card and Bank Account
- Recurrent transactions
- Card Tokenization
- Pre-authorized payment
- Order Payments
- Mobile Money Payments
- Transaction Validation
Requirements
PHP 8
Installation
You can use Composer or simply Download the Release
Composer
The preferred method is via composer. Follow the composer installation instructions if you do not already have composer installed.
Once composer is installed, execute the following command in your project root to install this library:
composer require seerbit/seerbit-php-sdk
Find examples here
Example 1 : Start a Standard transaction
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" => "customer@email.com", "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(); }
Find more examples here
How to Generate a Token?
curl --location 'https://seerbitapi.com/api/v2/encrypt/keys' \
--header 'Content-Type: application/json' \
--data '{
"key": "merchantSecretKey.merchantPublicKey"
}'
Generate Token Response
{
"status": "SUCCESS",
"data": {
"code": "00",
"EncryptedSecKey": {
"encryptedKey": "SNt8kjeVjsdTG4lPlwg6sTvpVAay2RA7hoCEzHPkIQa+MNfDepx4VBr5JMgLb5Q5anq9XoN2pXU850bumqBWFVw1T1ZW5w8N+Sq/"
},
"message": "Successful"
}
}
Configure Logger
//Set Logger path $client->setLoggerPath(dirname(__FILE__)); //Set custom Logger $client->setLogger = $->CustomLoggerService();
Documentation
Examples
Changelog
Please see CHANGELOG for more information what has changed recently.
Support
If you have any problems, questions or suggestions, create an issue here or send your inquiry to developers@seerbit.com.
Contributing
We encourage you to join us in contributing to this repository so everyone can benefit from:
- New features and functionality
- Resolved bug fixes and issues
- Any general improvements
Read our contribution guidelines to find out how.
Licence
The MIT License (MIT). Please see License File for more information.