mrjavaci / paytr
dev-master
2023-05-04 14:03 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
This package is auto-updated.
Last update: 2024-09-04 16:41:52 UTC
README
安装
composer require mrjavaci/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 发送的支付结果的代码部分。