1. Go to this page and download the library: Download paysys/cardpay 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/ */
paysys / cardpay example snippets
class OrderPresenter extends Presenter
{
/** @var \PaySys\PaySys\IButtonFactory @inject */
public $cardPayButtonFactory;
/** @var \PaySys\CardPay\Security\Request @inject */
public $cardPayRequest;
protected function createComponentCardPayButton()
{
$payment = new \PaySys\CardPay\Payment("12.34", "00456", "John Doe");
$button = $this->cardPayButtonFactory->create($payment);
$button->onPayRequest[] = function ($payment) {
$this->redirectUrl($this->cardPayRequest->getUrl($payment));
};
return $button;
}
}
class OrderPresenter extends Presenter
{
/** @var Nette\Http\IRequest @inject */
public $httpRequest;
/** @var \PaySys\CardPay\Security\Response @inject */
public $bankResponse;
public function actionProcessCardPay()
{
try {
$this->bankResponse->paid($this->httpRequest->getQuery());
// store info about payment
$this->flashMessage('Thanks for payment.', 'success');
} catch (\PaySys\PaySys\Exception $e) {
// log
$this->flashMessage('Payment failed. Please try it later.', 'danger');
}
$this->redirect('finish');
}
}
class \PaySys\PaySys\Exception extends \Exception {}
class \PaySys\PaySys\SignatureException extends \PaySys\PaySys\Exception {}
class \PaySys\PaySys\ServerException extends \PaySys\PaySys\Exception {}
class \PaySys\PaySys\InvalidArgumentException extends \PaySys\PaySys\Exception {}
class \PaySys\PaySys\ConfigurationException extends \PaySys\PaySys\Exception {}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.