Bancard
A minimal implementation for Bancard API vPOS 2.0
Installation
Requirements
- PHP >= 7.3
Installing
Run the following command in your console terminal:
$ composer require zrkb/bancard
Usage
Single Buy Request
use Bancard\Bancard;
use Bancard\Util\Currency;
Bancard::setPrivateKey('PRIVATE_KEY');
Bancard::setPublicKey('PUBLIC_KEY');
Bancard::setStaging(true);
$bancard = new Bancard;
$response = $bancard->singleBuy([
'shop_process_id' => 7777777, // MUST be an integer
'name' => 'My Product',
'description' => 'Product Description',
'amount' => '10000.00', // two decimals required
'currency' => Currency::PYG,
'return_url' => 'https://app.test/return_url',
'cancel_url' => 'https://app.test/cancel_url',
]);
The above example will return:
{
"status": "success",
"process_id": "KKt*PMyY88Jv88Wjrk7-"
}
Single Buy Confirm
$response = $bancard->singleBuyConfirm([
'shop_process_id' => 7777777,
'amount' => '10000.00', // two decimals required
'currency' => Currency::PYG,
]);
Single Buy Get Confirmation
$response = $bancard->singleBuyGetConfirmation([
'shop_process_id' => 7777777,
]);
Single Buy Rollback
$response = $bancard->singleBuyRollback([
'shop_process_id' => 7777777,
]);
Security
If you discover any security related issues, please use the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.