PHP code example of bitsika / merchant-sdk-php

1. Go to this page and download the library: Download bitsika/merchant-sdk-php 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/ */

    

bitsika / merchant-sdk-php example snippets




use Bitsika\Merchant;

$merchant = new Merchant('PUT_YOUR_SECRET_KEY_HERE');

$response = $merchant->detail();

var_dump($response);

$response = $merchant->statistics();

var_dump($response);

$response = $merchant->invoices()->create([
    "title" => "Vanilla Ice-Cream",
    "description" => "2 scoops of vanilla ice-cream, chocolate biscuits and coconut shavings.",
    "amount" => 2000000,
    "currency" => "NGN",
    "recipient_email" => "[email protected]",
    "photo_url" => "https://image.com/test.jpg"
]);

var_dump($response);

$invoiceId = 'INVOICE_ID_HERE';
$response = $merchant->invoices()->get($invoiceId);

var_dump($response);

$response = $merchant->transaction()->sendCash([
   "platform" => "bitsika",
   "amount" => 100,
   "currency" => "USD",
   "username" => "davido",
   "debit_from" => "USD",
   "purpose" => ""
]);

var_dump($response);


$transactionId = "YOUR_TRANSACTION_ID_HERE";

$response = $merchant->transaction()->get($transactionId);

var_dump($response);


$username = "USERNAME_HERE";

$response = $merchant->customer()->search($username);

var_dump($response);

$response = $merchant->virtualCard()->create([
   "name" => "Tommie Nii Darku", 
   "currency" => "USD", 
   "amount" => 11, 
   "debit_from" => "GHS" 
]);

var_dump($response);

$response = $merchant->virtualCard()->all();

var_dump($response);

$cardId = 113;
$response = $merchant->virtualCard()->get($cardId);

var_dump($response);

$cardId = 113;
$response = $merchant->virtualCard()->topUp($cardId, [
   "amount" => "10", 
   "currency" => "USD", 
   "debit_from" => "GHS"
]);

var_dump($response);

$cardId = 113;
$response = $merchant->virtualCard()->withdraw($cardId, [
   "amount" => "5"
]);

var_dump($response);

$cardId = 113;
$response = $merchant->virtualCard()->transactions($cardId);

var_dump($response);

$cardId = 113;
$response = $merchant->virtualCard()->freeze($cardId);

var_dump($response);

$cardId = 113;
$response = $merchant->virtualCard()->unfreeze($cardId);

var_dump($response);

if($_SERVER['HTTP_X_BITSIKA_SIGNATURE'] !== hash_hmac('sha512', $input, YOUR_SECRET_KEY_HERE))
    exit();
bash
composer 
json
{
    "itsika/merchant-sdk-php": "1.0.9"
    }
}
bash