lzaplata / comgate
There is no license information available for the latest version (dev-master) of this package.
Comgate wrapper for Nette Framework.
dev-master
2018-10-17 20:02 UTC
Requires
- php: >=5.4
- guzzlehttp/guzzle: 5.3.2
- nette/application: ~2.3
- nette/di: ~2.3
- nette/utils: 2.3.11
- tracy/tracy: ~2.3
This package is auto-updated.
Last update: 2025-03-25 09:11:25 UTC
README
This is small Nette Framework wrapper for Comgate.
Installation
The easiest way to install library is via Composer.
$ composer require lzaplata/comgate: dev-master
or edit composer.json
in your project
"require": { "lzaplata/comgate": "dev-master" }
You have to register the library as extension in config.neon
file.
extensions: comgate: LZaplata\Comgate\DI\Extension
Now you can set parameters...
comgate: merchant : * secret : * sandbox : true preauth : false
...and autowire library to presenter
use LZaplata\Comgate\Service; /** @var Service @inject */ public $comgate;
Usage
Create payment.
$payment = $this->comgate->createPayment( $price // total price - float );
Get payment ID and save it to database.
$payId = $payment->getPayId();
Send payment.
$response = $payment->send();
Redirect to payment gateway.
$this->sendResponse($response->getRedirectResponse());
...or get redirect url.
$response->getRedirectUrl();
After return from gateway
Get response and check if payment was successful
$response = $this->comgate->getReturnResponse(); if ($response->isOk()) { $payId = $response->getPayId(); // do something } // output must be clean, so you have to terminate presenter and turn off Tracy $this->terminate();