zrkb / bancard
A minimal implementation for Bancard API vPOS 2.0
0.6.2
2021-09-08 15:33 UTC
Requires
- php: ^7.3 | ^8.0
- guzzlehttp/guzzle: ^6.3 | ^7.0
- zrkb/php-http-client: ^0.3.7
Requires (Dev)
- phpstan/phpstan: ^0.12.90
README
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.