contributte/thepay

ThePay library - nette extension

Maintainers

👁 f3l1x

Package info

github.com/contributte/thepay

pkg:composer/contributte/thepay

Statistics

Installs: 707 786

Dependents: 0

Suggesters: 2

Stars: 2

Open Issues: 1

v5.0.0 2026-03-27 15:10 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 8c2b96f6c5d9a8bf4b6f49c20110f431821788bb

extensionnettethe pay


README

👁 Image

👁 Image
👁 Image
👁 Image
👁 Image

👁 Image
👁 Image
👁 Image
👁 Image
👁 Image

Website 🚀 contributte.org | Contact 👨🏻‍💻 f3l1x.io | Twitter 🐦 @contributte

Nette integration for ThePay API client with DI configuration and ready-to-use payment services.

Versions

State Version Branch PHP
dev ^5.0 master >= 8.2
stable ^4.1 v4.x >= 7.1

Contents

Installation

To install the latest version of contributte/thepay use Composer.

composer require contributte/thepay

Requirements

This extension requires PSR-18 HTTP client and PSR-17 HTTP factories to be registered in your DI container.

The recommended implementation is Guzzle:

composer require guzzlehttp/guzzle

You need to register the PSR interfaces in your neon config:

services:
	- GuzzleHttp\Client
	- GuzzleHttp\Psr7\HttpFactory

Configuration

Register the extension:

extensions:
	contributte.thepay: Contributte\ThePay\DI\ThePayExtension

List of all options:

contributte.thepay:
	demo: true/false
	merchantId: 'your-merchant-id'
	projectId: (int)
	apiPassword: ''
	apiUrl: 'https://api.thepay.cz/'
	gateUrl: 'https://gate.thepay.cz/'
	language: 'cs'

Minimal production configuration:

contributte.thepay:
	merchantId: 'your-merchant-id'
	projectId: (int)
	apiPassword: ''

Demo configuration:

contributte.thepay:
	demo: true
	merchantId: 'your-merchant-id'
	projectId: (int)
	apiPassword: ''

When demo: true is set, apiUrl and gateUrl are automatically switched to demo endpoints.

Services Available in DI Container

  • ThePay\ApiClient\TheConfig
  • ThePay\ApiClient\Service\SignatureService
  • ThePay\ApiClient\Service\ApiService (implements ApiServiceInterface)
  • ThePay\ApiClient\Service\GateService (implements GateServiceInterface)
  • ThePay\ApiClient\TheClient

Usage

Create a Payment

use Nette\Application\UI\Presenter;
use ThePay\ApiClient\Model\CreatePaymentParams;
use ThePay\ApiClient\TheClient;

class OrderPresenter extends Presenter
{
	public function __construct(
		private TheClient $thePayClient,
	) {
		parent::__construct();
	}

	public function actionPay(): void
	{
		$params = new CreatePaymentParams(10000, 'CZK', 'order-123');
		$payment = $this->thePayClient->createPayment($params);

		$this->redirectUrl($payment->getPayUrl());
	}
}

Render Payment Buttons

use Nette\Application\UI\Presenter;
use ThePay\ApiClient\Model\CreatePaymentParams;
use ThePay\ApiClient\TheClient;

class OrderPresenter extends Presenter
{
	public function __construct(
		private TheClient $thePayClient,
	) {
		parent::__construct();
	}

	public function renderPaymentMethods(): void
	{
		$params = new CreatePaymentParams(10000, 'CZK', 'order-123');
		$this->template->paymentButtons = $this->thePayClient->getPaymentButtons($params);
	}
}

Verify a Payment

use Nette\Application\UI\Presenter;
use ThePay\ApiClient\TheClient;

class OrderPresenter extends Presenter
{
	public function __construct(
		private TheClient $thePayClient,
	) {
		parent::__construct();
	}

	public function actionConfirmation(string $paymentUid): void
	{
		$payment = $this->thePayClient->getPayment($paymentUid);

		if ($payment->wasPaid()) {
			// Payment was successful.
		}
	}
}

Official Documentation

Development

See how to contribute to this package.

This package is currently maintained by these authors.

👁 Image
👁 Image

Consider to support contributte development team. Also thank you for using this package.