akalati / omnipay-benefitgateway
Omnipay支付处理库的益处网关驱动程序
3.0.2
2021-09-19 14:34 UTC
Requires
- php: ^7.3|^8.0
- omnipay/common: ^3.1
Requires (Dev)
- omnipay/tests: ^3|^4
This package is auto-updated.
Last update: 2024-09-20 04:39:04 UTC
README
Omnipay PHP支付处理库的益处网关驱动程序
Omnipay 是一个不依赖于框架的、多网关的PHP 5.3+支付处理库。本包实现了Omnipay对益处网关的支持。
安装
Omnipay通过Composer安装。对于大多数用途,您需要要求league/omnipay
和一个单独的网关
composer require league/omnipay:^3 akalati/omanipay-benefitgateway
如果您想使用自己的HTTP客户端而不是Guzzle(这是league/omnipay
的默认设置),则可以要求league/common
和任何php-http/client-implementation
(请参阅PHP Http)
composer require league/common:^3 akalati/omanipay-benefitgateway php-http/buzz-adapter
基本用法
本包提供以下方法
- 购买
- 完成购买
购买
使用购买请求构建重定向链接并将客户重定向到益处网关支付页面
$gateway = Omnipay::create('BenefitGateway'); $gateway->setTestMode(true); //call setTestMode(true) to use benefit gateway test endpoint https://www.test.benefit-gateway.bh/payment/PaymentHTTP.htm?param=paymentInit $gateway->setId(""); //Tranportal ID $gateway->setPassword(""); // Tranportal Password $gateway->setResourceKey(""); // Terminal Resourcekey $response = $gateway->purchase([ 'amount' => 20.5, //Amount in BHD 'transactionId' => 1, //Order or transaction reference from your system 'returnUrl' => "https://www.example.com/return", //return url 'cancelUrl' => "https://www.example.com/error" //error and cancel url ])->send(); $response->redirect();
完成购买
在您的返回回调中使用完成购买来处理网关发送到您的系统的请求
$gateway = Omnipay::create('BenefitGateway'); $gateway->setResourceKey(""); // Terminal Resourcekey $response = $gateway->completePurchase()->send(); if ($response->isSuccessful()) { $transactionId = $response->getTransactionId(); //transaction id set in the purchase request $transactionReference = $response->getTransactionReference(); //transaction reference set by the gateway $responseData = $response->getData(); //response received from benefit gateway // mark order as complete } else { $response->getMessage(); // display error message to customer }
有关一般使用说明,请参阅Omnipay的主要仓库。
支持
如果您在使用Omnipay时遇到一般问题,我们建议在Stack Overflow上发布。请确保添加omnipay标签,以便易于查找。
如果您想及时了解发布公告,讨论项目想法或提出更详细的问题,还有一个您可以订阅的邮件列表。
如果您认为您发现了一个bug,请使用GitHub问题跟踪器报告它,或者更好的是,分叉库并提交一个pull请求。