mews / paytr
PayTr 支付系统
0.3.5
2023-11-06 14:36 UTC
Requires
- php: >=7.1.3
- ext-json: *
- symfony/http-client: ^4.0|^5.0|^6.0
- symfony/http-foundation: ^4.0|^5.0|^6.0
README
##PayTR 支付系统 PHP 库(PHP 7.1.3+)
安装
composer require mews/paytr
示例使用,位于 example
目录中。
$payment = new Mews\PayTr\Payment( require __DIR__ . '/../config/paytr.php' );
创建的实例使用默认配置。这些配置位于 config/paytr.php
中。您需要根据项目中的 PayTR 账户更新这些设置。
如果您想使用不同的配置创建实例,示例如下:
$payment = new Mews\PayTr\Payment([ 'apiUrl' => 'https://www.paytr.com/odeme/api/get-token', 'merchantId' => 'XXXXXX', 'merchantKey' => 'XXXXXXXXXXXX', 'merchantSalt' => 'XXXXXXXXXXXX', 'successUrl' => 'https://paytr.test/example/index.php?status=success', 'failUrl' => 'https://paytr.test/example/index.php?status=fail', ]);
或
$payment = new Mews\PayTr\Payment(); $payment->setConfig(new Mews\PayTr\Config([ 'apiUrl' => 'https://www.paytr.com/odeme/api/get-token', 'merchantId' => 'XXXXXX', 'merchantKey' => 'XXXXXXXXXXXX', 'merchantSalt' => 'XXXXXXXXXXXX', 'successUrl' => 'https://paytr.test/example/index.php?status=success', 'failUrl' => 'https://paytr.test/example/index.php?status=fail', ]));
example
目录中的index.php
和payment.php
是用于支付操作的示例。callback.php
是处理 PayTR 发送的支付结果的代码部分。