lzaplata / thepay
ThePay 2.0 wrappper for Nette framework
v1.0.0
2022-02-23 13:23 UTC
Requires
- php: >=7.2
- nette/di: ^v3.0.12
- thepay/api-client: ^v1.3.3
This package is auto-updated.
Last update: 2025-03-23 20:48:13 UTC
README
This is small Nette Framework wrapper for ThePay 2.0 payment gateway.
Installation
The easiest way to install library is via Composer.
$ composer require lzaplata/thepay: dev-master
or edit composer.json
in your project
"require": { "lzaplata/thepay": "dev-master" }
You have to register the library as extension in config.neon
file.
extensions: thepay: LZaplata\ThePay\DI\Extension
Now you can set parameters...
thepay: demo : true|false merchantId : * projectId : * apiPassword : *
...and autowire library to presenter
use LZaplata\ThePay\Service; /** @var Service @inject */ public $thepay;
Usage
Create payment parameters, set return or notify URL just like in original API client example.
https://packagist.org/packages/thepay/api-client
$paymentParams = new CreatePaymentParams($amount, $currencyCode, $uid); $paymentParams->setReturnUrl("some return URL");
Create payment.
$payment = $this->thepay->createPayment($paymentParams);
Redirect to payment gateway.
$this->sendResponse(new RedirectResponse($payment->getPayUrl()));