Download the SDK package
Complete this step before moving to production testing.
Integrate standard checkout, express merchant payments, callbacks, and optional AGILAB add-on APIs when those add-ons are installed and activated.
POST /payment/form
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Use this guide to integrate branded payment checkout, redirect handling, transaction verification, and production-safe callbacks without exposing merchant secrets.
Complete this step before moving to production testing.
Complete this step before moving to production testing.
Complete this step before moving to production testing.
Complete this step before moving to production testing.
Use your merchant Client ID and Client Secret from the merchant/admin API credential area. Keep credentials in environment variables or encrypted server configuration.
Never expose your Client Secret in frontend JavaScript, public HTML, mobile apps, or browser-side code. Use it only on your secure server-side backend.
Set the payer payment method to your active brand or system payment method. Other payment methods can be added later when supported.
// Payer Object
$payer = new Payer();
$payer->setPaymentMethod('Sibaq'); // preferably, your system or brand name
Specify the payment amount and currency. The currency must exist in the merchant wallet list.
// Amount Object
$amountIns = new Amount();
$amountIns->setTotal(20)->setCurrency('USD');
Attach the amount object to the transaction resource. Use your own order reference when the SDK or gateway supports it.
// Transaction Object
$trans = new Transaction();
$trans->setAmount($amountIns);
Set where the buyer should return after a successful or cancelled payment. Keep these URLs under your verified domain.
// RedirectUrls Object
$urls = new RedirectUrls();
$urls->setSuccessUrl('https://your-domain.com/sibaq-sdk/example-success.php')
->setCancelUrl('https://your-domain.com/sibaq-sdk/');
Create the payment with merchant credentials, redirect URLs, payer, and transaction. Redirect the buyer to the approved URL returned by the gateway.
// Payment Object
$payment = new Payment();
$payment->setCredentials([
'client_id' => 'place your client id here',
'client_secret' => 'place your client secret here'
])->setRedirectUrls($urls)
->setPayer($payer)
->setTransaction($trans);
try {
$payment->create();
header('Location: ' . $payment->getApprovedUrl());
exit;
} catch (Exception $ex) {
print $ex;
exit;
}
Success and cancel URLs return the customer to your website. Callback/webhook URLs should be used for final order updates because browser redirects can be interrupted by users.
$urls = new RedirectUrls();
$urls->setSuccessUrl('https://your-domain.com/payment/success')
->setCancelUrl('https://your-domain.com/payment/cancel');
After payment is completed, the gateway sends the transaction result to your callback URL. Treat the callback as the source of truth for order updates.
Do not credit the same transaction twice. Always check if the transaction reference already exists before updating the order.
Includes PHP connection file, payment example, and setup guide.
require 'vendor/autoload.php';
use Sibaq\Api\Payer;
use Sibaq\Api\Amount;
use Sibaq\Api\Transaction;
use Sibaq\Api\RedirectUrls;
use Sibaq\Api\Payment;
$payer = new Payer();
$payer->setPaymentMethod('Sibaq');
$amountIns = new Amount();
$amountIns->setTotal(20)->setCurrency('USD');
$trans = new Transaction();
$trans->setAmount($amountIns);
$urls = new RedirectUrls();
$urls->setSuccessUrl('https://your-domain.com/sibaq-sdk/example-success.php')
->setCancelUrl('https://your-domain.com/sibaq-sdk/');
$payment = new Payment();
$payment->setCredentials([
'client_id' => getenv('Sibaq_CLIENT_ID'),
'client_secret' => getenv('Sibaq_CLIENT_SECRET'),
])->setRedirectUrls($urls)
->setPayer($payer)
->setTransaction($trans);
$payment->create();
header('Location: ' . $payment->getApprovedUrl());
exit;
| Code | Meaning | What to do |
|---|---|---|
INVALID_CLIENT | Client ID or secret is wrong | Check API credentials |
INVALID_AMOUNT | Amount is missing or invalid | Send valid amount |
INVALID_CURRENCY | Currency is unsupported | Use supported currency |
PAYMENT_CANCELLED | Customer cancelled payment | Redirect to cancel URL |
PAYMENT_FAILED | Payment could not be completed | Retry or contact support |