nekofar / omnipay-yekpay
用于Omnipay PHP支付处理库的Yekpay驱动程序
v1.0.0-alpha.5
2022-05-15 06:46 UTC
Requires
- php: ^7.0
- ext-json: *
- omnipay/common: ^3.0
Requires (Dev)
- omnipay/tests: ^3.1
- phpunit/phpunit: ^6.0
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2024-09-10 10:53:57 UTC
README
用于Omnipay PHP支付处理库的Yekpay驱动程序
Omnipay 是一个不依赖于框架、支持多网关的PHP支付处理库。本包实现了Omnipay对Yekpay的支持。
安装
通过 Composer 安装Omnipay。要安装,只需在Composer中要求 league/omnipay
和 nekofar/omnipay-yekpay
composer require league/omnipay nekofar/omnipay-yekpay
基本用法
本包提供了以下网关
- Yekpay
有关通用使用说明,请参阅主要的 Omnipay 仓库。
示例
购买
结果将重定向到网关或银行。
use Omnipay\Omnipay; $gateway = Omnipay::create('Yekpay'); $this->gateway->setMerchantId('XXXXXXXXXXXXXXXXXXXX'); $this->gateway->setReturnUrl('https://example.com/callback.php'); // Send purchase request $response = $gateway->purchase([ 'amount' => 799.00, 'fromCurrencyCode' => 978, 'toCurrencyCode' => 364, 'orderNumber' => 125548, 'firstName' => 'John', 'lastName' => 'Doe', 'email' => 'test@example.com', 'mobile' => '+44123456789', 'address' => 'Alhamida st Al ras st', 'postalCode' => '64785', 'country' => 'United Arab Emirates', 'city' => 'Dubai', 'description' => 'Apple mac book air 2017', ])->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([ '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 问题跟踪器 报告它,或者更好的是,分支库并提交一个pull请求。