nekofar / omnipay-zarinpal
Omnipay PHP支付处理库的ZarinPal驱动程序
v2.0.1
2023-05-18 17:21 UTC
Requires
- php: >=8.1
- ext-json: *
- http-interop/http-factory-guzzle: ^1.2
- moneyphp/money: ^4.1
- omnipay/common: ^3.1
- php-http/message-factory: ^1.1
- symfony/http-client: ^6.2
- symfony/http-foundation: ^6.2
Requires (Dev)
- nekofar/coding-standard: ^2.0
- nekofar/dev-tools: ^2.2
- omnipay/tests: ^4.1
- phpstan/phpstan: ^1.10
- phpstan/phpstan-beberlei-assert: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- phpstan/phpstan-strict-rules: ^1.5
- phpunit/phpunit: ^9.6
- slevomat/coding-standard: ^7.0
- squizlabs/php_codesniffer: ^3.7
- v2.0.1
- v2.0.0
- v1.3.11
- v1.3.10
- v1.3.9
- v1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.0
- dev-master / 1.0.x-dev
- 1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.1.0
- dev-dependabot/github_actions/develop/actions/checkout-4.1.1
- dev-dependabot/github_actions/develop/orhun/git-cliff-action-2.1.1
- dev-dependabot/github_actions/develop/shivammathur/setup-php-2.26.0
- dev-dependabot/github_actions/develop/actions/cache-3.3.2
- dev-develop
This package is auto-updated.
Last update: 2024-09-18 16:12:40 UTC
README
Omnipay PHP支付处理库的ZarinPal驱动程序
Omnipay 是一个不依赖于框架的、多网关的PHP支付处理库。本包实现了Omnipay的ZarinPal支持。
安装
Omnipay通过 Composer 安装。要安装,只需使用Composer要求 league/omnipay
和 nekofar/omnipay-zarinpal
composer require league/omnipay nekofar/omnipay-zarinpal
基本用法
本包提供以下网关
- ZarinPal
有关一般使用说明,请参阅主 Omnipay 存储库。
示例
购买
结果将重定向到网关或银行。
use Omnipay\Omnipay; $gateway = Omnipay::create('ZarinPal'); $gateway->setMerchantId('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'); $gateway->setReturnUrl('https://www.example.com/return'); // Send purchase request $response = $gateway->purchase([ 'amount' => 100, 'description' => 'Some description' ])->send(); // Process response if ($response->isRedirect()) { // Redirect to offsite payment gateway $response->redirect(); } else { // Payment failed: display message to customer echo $response->getMessage(); }
返回时,completePurchase将提供交易尝试的结果。
最终结果包括以下方法以检查其他详细信息
// Send purchase complete request $response = $gateway->completePurchase([ 'amount' => 100, 'authority' => $_REQUEST['Authority'], )->send(); // Process response if ($response->isSuccessful()) { // Payment was successful print_r($response); } else { // Payment failed: display message to customer echo $response->getMessage(); }
测试
composer test
支持
如果您在使用Omnipay时遇到一般问题,我们建议在 Stack Overflow 上发帖。请务必添加 omnipay标签,以便易于查找。
如果您想了解发布公告,讨论项目的想法或提出更详细的问题,还有一个您可订阅的 邮件列表。
如果您认为您发现了错误,请使用 GitHub问题跟踪器 报告它,或者更好的是,分支库并提交拉取请求。