Code Monkey home page Code Monkey logo

seerbit-php-sdk's Introduction

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" => "[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();
}

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

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 [email protected].

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.

seerbit-php-sdk's People

Contributors

seerbit-developers avatar victorighalo avatar leoactionz avatar henry2100 avatar

Stargazers

 avatar

Watchers

James Cloos avatar

seerbit-php-sdk's Issues

PHP 8 Compatibility

Hi,
Thanks for this library
Some method signatures have been deprecated in PHP8 in your curl client service
public function POST(IService $service, $requestUrl, $params = null, $token = null,$authType)
public function GET(IService $service, $requestUrl, $token = null,$authType)
public function PUT(IService $service, $requestUrl, $params = null, $token = null,$authType)

All displaying the error Required parameter $authType follows optional parameter $params as stated. You may have to ditch those nulls or perhaps you might want to use an established php http client like Guzzle and co

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.