PHP code example of nattreid / b-payment
1. Go to this page and download the library: Download nattreid/b-payment 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/ */
nattreid / b-payment example snippets
/** @var \NAttreid\BPayment\IBPaymentClientFactory @inject */
public $bPaymentFactory;
protected function createComponentBPayment($name) {
$bPayment = $this->bPaymentFactory->create($this, $name);
$bPayment->setOrderId(123456);
$bPayment->setCurrency('CZK');
$bPayment->setLanguage('CZ');
$bPayment->addItem('Polozka', 4, 999.9);
$bPayment->onSuccess[] = function($orderId, $authorizationCode) {
}
$bPayment->onError[] = function($errorCode, $errorDescription) {
}
$bPayment->onCancel[] = function() {
}
return $bPayment;
}