lzaplata/thepay

ThePay 2.0 wrappper for Nette framework

v1.0.0 2022-02-23 13:23 UTC

This package is auto-updated.

Last update: 2024-04-23 18:58:57 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()));