PHP code example of bilions / kbank-sdk
1. Go to this page and download the library: Download bilions/kbank-sdk 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/ */
bilions / kbank-sdk example snippets
use Bilions\Kbank;
_URL' => $_ENV['KBANK_BASE_URL'],
'KBANK_API_KEY' => $_ENV['KBANK_API_KEY'],
'KBANK_MID' => $_ENV['KBANK_MID'],
'KBANK_TID' => $_ENV['KBANK_TID'],
];
$kbank = new Kbank($config);
$kbank->paymentType = 'qr';
$kbank->amount = 100;
$kbank->currency = 'THB';
$kbank->description = 'Description Here';
$kbank->referenceOrder = uniqid();
$kbank->token = '{your-request-token-here}'; // only for card payment
$result = $kbank->getRedirectUrl();
$result = $kbank->getQRPaymentOrderId();
$result = $kbank->getCharge('{your-request-token-here}');
print_r($result);