2017 © Pedro Peláez
 

library payu

PayU wrapper for Nette Framework.

image

lzaplata/payu

PayU wrapper for Nette Framework.

  • Monday, February 5, 2018
  • by Zap
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PayU

This is small Nette Framework wrapper for PayU gateway., (*1)

Installation

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;

Usage

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);

The Versions

05/02 2018

dev-master

9999999-dev https://github.com/LZaplata/payu

PayU wrapper for Nette Framework.

  Sources   Download

New BSD

The Requires

 

by Lukáš Záplata

nette payu