PHP code example of abdullahhafizh / jokul-php-library
1. Go to this page and download the library: Download abdullahhafizh/jokul-php-library 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/ */
abdullahhafizh / jokul-php-library example snippets
// Instantiate class
$DOKUClient = new DOKU\Client;
// Set your Client ID
$DOKUClient->setClientID('[YOUR_CLIENT_ID]');
// Set your Shared Key
$DOKUClient->setSharedKey('[YOUR_SHARED_KEY]');
// Call this function for production use
$DOKUClient->isProduction(true);
// Call this function to generate BCA VA
$DOKUClient->generateBcaVa($params);
// Call this function to generate Bank Mandiri VA
$DOKUClient->generateMandiriVa($params);
// Call this function to generate Bank Syariah Indonesia VA
$DOKUClient->generateBsiVa($params);
// Call this function to generate DOKU VA
$DOKUClient->generateDokuVa($params);
// Mapping the notification received from Jokul
$notifyHeaders = getallheaders();
$notifyBody = json_decode(file_get_contents('php://input'), true); // You can use to parse the value from the notification body
$targetPath = '/payments/notifications'; // Put this value with your payment notification path
$secretKey = 'SK-xxxxxxx'; // Put this value with your Secret Key
// Prepare Signature to verify the notification authenticity
$signature = \DOKU\Common\Utils::generateSignature($notifyHeaders, $targetPath, file_get_contents('php://input'), $secretKey);
// Verify the notification authenticity
if ($signature == $notifyHeaders['Signature']) {
http_response_code(200); // Return 200 Success to Jokul if the Signature is match
// TODO update transaction status on your end to 'SUCCESS'
} else {
http_response_code(401); // Return 401 Unauthorized to Jokul if the Signature is not match
// TODO Do Not update transaction status on your end yet
}
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.