PHP
Official server-side SDK (wajub/wajub-php) for PHP 8.2+ — payments, payouts, webhooks, and the full merchant API.
12 min read
PHP is Wajub's official server-side SDK for Laravel, Symfony, and any PHP 8.2+ backend. It is published as wajub/wajub-php on Packagist.
Use it with your API key (pk_… / sk_… / rk_…, including test variants). Pair it with @wajub/js in the browser.
Browser vs server
@wajub/js runs in the browser with publishable keys.
wajub/wajub-php runs on the server — pass any merchant API key
(pk., sk., rk.) and use webhook verification for inbound
events. Never expose sk. keys to the client.
Install
composer require wajub/wajub-phpRequires PHP 8.2+ and Guzzle 7.
Quick start
<?php
use Wajub\Wajub;
$wajub = new Wajub([
'api_key' => getenv('WAJUB_SECRET_KEY'),
]);
$payment = $wajub->payments->create([
'amount' => 15000,
'currency' => 'XAF',
'email' => 'buyer@example.com',
'callback' => 'https://shop.example.com/order/complete',
]);
header('Location: ' . $payment['authorization_url']);Configuration
| Option | Description |
|---|---|
api_key | Merchant API key (pk.… / sk.… / rk.…, test or live) |
webhook_secret | Signing secret (whsec_…) for webhooks->constructEvent() |
idempotency_key_prefix | Prefix for auto-generated Idempotency-Key headers |
Resources
| Property | Methods |
|---|---|
$wajub->global | ping, channels, countries, currencies |
$wajub->payments | create, initialize, retrieve, list, cancel, process, processSplit, listRefunds |
$wajub->customers | CRUD + block, unblock, activate, deactivate, tax IDs |
$wajub->refunds | CRUD + list |
$wajub->transfers | CRUD + list |
$wajub->beneficiaries | CRUD + list |
$wajub->links | CRUD + list |
$wajub->invoices | CRUD + send, markPaid, cancel |
$wajub->accounts | CRUD + regenerateToken |
$wajub->webhookEndpoints | CRUD + rotateSecret |
$wajub->balance | retrieve |
$wajub->events | list, retrieve, resend |
$wajub->disputes | list, retrieve, submitEvidence, accept, close, sendMessage |
$wajub->identity | resolve, validate |
$wajub->tax | settings, rates, calculate, reports, codes, registrations |
$wajub->shield | settings, stats, blocklist |
$wajub->listen | config, auth |
$wajub->webhooks | constructEvent |
Webhooks (Laravel / Symfony)
<?php
use Wajub\RequestOptions;
$event = $wajub->webhooks->constructEvent(
$request->getContent(),
$request->headers->get('X-Wajub-Signature'),
$request->headers->get('X-Wajub-Timestamp'),
);
// Handle payment.succeeded, transfer.succeeded, etc.Sync (Connect)
<?php
use Wajub\RequestOptions;
$wajub->payments->create($params, new RequestOptions(sync: 'acct_sync_ref'));Was this page helpful?