qbirr/sdk (PHP)

Verify Ethiopian bank transfer receipts in real time.

Install

composer require qbirr/sdk

Requires PHP 7.4+ and the curl + json extensions (standard on almost every host).

Quick start

use Qbirr\Qbirr;

$qb = new Qbirr($_ENV['QBIRR_API_KEY']);

$r = $qb->verify([
    'provider'         => 'cbe',
    'ref'              => 'FT23001234ABC',
    'amount'           => 500,
    'receiver_name'    => 'YOUR FULL NAME',
    'receiver_account' => '1000017692643',
]);

if ($r['verified']) {
    echo "Paid by " . $r['payer'] . ", amount: " . $r['amount'];
} else {
    echo "Failed: " . $r['error'];
}

Drop-in for WordPress / Laravel / vanilla PHP

Works the same in every framework — it's just curl under the hood.

// WordPress / WooCommerce — inside a payment gateway
$r = (new Qbirr\Qbirr(get_option('qbirr_api_key')))->verify([...]);

// Laravel
$r = (new \Qbirr\Qbirr(config('services.qbirr.key')))->verify([...]);

// Vanilla
require 'vendor/autoload.php';
$r = (new Qbirr\Qbirr(getenv('QBIRR_API_KEY')))->verify([...]);

Errors

use Qbirr\Qbirr;
use Qbirr\QbirrException;

try {
    $r = $qb->verify([ ... ]);
} catch (QbirrException $e) {
    error_log("qbirr error " . $e->status . ": " . $e->getMessage());
}

Verification failures (wrong amount, wrong receiver) are not exceptions — they're returned as ['verified' => false, 'error' => '...'].

License

MIT

S
Description
qbirr SDK - sdk-php
Readme 30 KiB
Languages
PHP 100%