1. Go to this page and download the library: Download zrkb/bancard 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/ */
zrkb / bancard example snippets
use Bancard\Bancard;
$bancard = new Bancard(
publicKey: 'YOUR_PUBLIC_KEY',
privateKey: 'YOUR_PRIVATE_KEY',
staging: true, // optional, defaults to false
guzzle: ['timeout' => 15], // optional Guzzle options
);
use Bancard\Exception\ApiException;
use Bancard\Exception\BancardException;
use Bancard\Exception\NetworkException;
use Bancard\Exception\ValidationException;
try {
$response = $bancard->singleBuy($payload);
} catch (ValidationException $e) {
// Missing // Timeout, DNS or TLS failure; $e->getPrevious() is Guzzle's exception
} catch (BancardException $e) {
// Response was not valid JSON (e.g. gateway error page); $e->getCode() is the HTTP status
}
use Bancard\Util\Currency;
$bancard->singleBuy([
'shop_process_id' => '7777777',
'amount' => 10000, // sent as "10000.00"
'currency' => Currency::PYG, // sent as "PYG"
]);
use Bancard\Util\Amount;
$formatted = Amount::format(10000); // "10000.00"
$normalized = Amount::normalize('10.5'); // "10.50" (null if invalid)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.