This library is an abstraction of Jokul's API for applications written with PHP.
- Main documentation
- Dashboard
composer require asokawotulo/jokul-php
Get the Client ID and Secret Key from Business Account > Service
use Jokul\Jokul;
Jokul::setClientId('MCH-xxxx-xxxxxxxxxxxxx');
Jokul::setSecretKey('SK-xxxxxxxxxxxxxxxxxxxx');
Jokul::setEnv(Jokul::PRODUCTION); // or Jokul::SANDBOX
use Jokul\Jokul;
use Jokul\Utils;
$requestTarget = '/api/target';
$secretKey = Jokul::getSecretKey();
$clientId = Jokul::getClientId();
$requestId = Utils::generateRequestId();
$requestTimestamp = Utils::generateRequestTimestamp();
$signature = Utils::generateSignature(
$secretKey,
$clientId,
$requestId,
$requestTimestamp,
$requestTarget,
);
$checkoutData = [
'order' => [
'amount' => 20000,
'invoice_number' => 'INV-123',
],
'payment' => [
'payment_due_date' => 60
]
];
$response = \Jokul\Checkout::create($checkoutData);
echo $response['payment']['url'];