contributte/thepay
Composer 安装命令:
composer require contributte/thepay
包简介
ThePay library - nette extension
关键字:
README 文档
README
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
- Requirements
- Configuration
- Services Available in DI Container
- Usage
- Official Documentation
- Development
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\TheConfigThePay\ApiClient\Service\SignatureServiceThePay\ApiClient\Service\ApiService(implementsApiServiceInterface)ThePay\ApiClient\Service\GateService(implementsGateServiceInterface)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.
Consider to support contributte development team. Also thank you for using this package.
contributte/thepay 适用场景与选型建议
contributte/thepay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 707.77k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 08 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「extension」 「nette」 「the pay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 contributte/thepay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 contributte/thepay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 contributte/thepay 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The "View Counter" bundle
A custom URL rule class for Yii 2 which allows to create translated URL rules
Invalidity check of documents in the database of Ministry of the Interior of the Czech Republic
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Provides a PHP interface for The AAM Group's RESTful API.
instead of `php bin/console doctrine:mapping:import`
统计信息
- 总下载量: 707.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 2
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-25