dev-master
9999999-dev https://github.com/LZaplata/payuPayU wrapper for Nette Framework.
New BSD
The Requires
by Lukáš Záplata
nette payu
PayU wrapper for Nette Framework.
This is small Nette Framework wrapper for PayU gateway., (*1)
The easiest way to install library is via Composer., (*2)
$ composer require lzaplata/payu: dev-master
or edit composer.json
in your project, (*3)
"require": { "lzaplata/payu": "dev-master" }
You have to register the library as extension in config.neon
file., (*4)
extensions: payu: LZaplata\PayU\DI\Extension
Now you can set parameters..., (*5)
payu: posId : * clientId : * clientSecret : * key2 : * sandbox : true
...and autowire library to presenter, (*6)
use LZaplata\PayU\Service; /** @var Service @inject */ public $payu;
In first step you must create order instantion., (*7)
$order = $this->payu->createOrder([ "description" => $description, "currencyCode" => $currency, "totalAmount" => $price, // order price in lowest currency unit (1 CZK = 100) "extOrderId" => $id, // eshop unique id "notifyUrl" => $notifyUrl, // url form sending notifications from PayU "continueUrl" => $continueUrl, // url to redirect after successful payment "products" => [ 0 => [ "name" => $productName, "unitPrice" => $unitPrice, // product price in lowest currency unit (1 CZK = 100) "quantity" => $quantity ] ], "buyer" => [ "email" => $email, "phone" => $phone, "firstName" => $name, "lastName" => $surname ] ]);
Second step decides if creating order is successful..., (*8)
try { $response = $this->payu->pay($order); } catch (\OpenPayU_Exception $e) { print $e->getMessage(); }
...and finally you can redirect to gateway., (*9)
$this->sendResponse($response);
PayU wrapper for Nette Framework.
New BSD
nette payu