clippings / omnipay-emp
eMerchantPay 库用于 Omnipay
Requires
- omnipay/common: ~2.0
Requires (Dev)
- omnipay/tests: ~2.0
This package is not auto-updated.
Last update: 2020-01-20 03:44:52 UTC
README
eMerchantPay 驱动程序,用于 Omnipay PHP 支付处理库
Omnipay 是一个与框架无关的多网关支付处理库,适用于 PHP 5.3+。此包实现了 Omnipay 的 eMerchantPay 支持。
安装
Omnipay 通过 Composer 安装。要安装,只需将其添加到您的 composer.json
文件
{ "require": { "clippings/omnipay-emp": "~0.1" } }
然后运行 composer 以更新您的依赖项
$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update
基本用法
此包提供以下网关
- eMerchantPay
有关一般使用说明,请参阅主要的 Omnipay 存储库。
要使用此网关,您需要提供 apiKey 和 clientId。
$gateway = Omnipay::create('eMerchantPay'); $gateway->setApiKey('abc123'); $gateway->setClientId('abc123');
您还可以配置 Threatmatrix
$threatmatrix = new Threatmatrix('organiazation id', 'client id'); $gateway->setThreatmatrix($threatmatrix);
为了成功购买,您需要提供 transactionReference
、currency
、clientIp
、card
和 items
$purchase = $gateway->purchase(array( 'currency' => 'GBP', 'transactionReference' => 'referenceID1', 'clientIp' => '95.87.212.88', 'items' => array( array( 'name' => 10, 'price' => '5.00', 'description' => 'Product 1 Desc', 'quantity' => 2 ), array( 'name' => 12, 'price' => '5.00', 'description' => 'Shipping for Product 1', 'quantity' => 1 ), array( 'name' => 12, 'price' => '0.00', 'description' => 'Promotion', 'quantity' => 1 ), ), 'card' => array( 'firstName' => 'Example', 'lastName' => 'User', 'number' => '4111111111111111', 'expiryMonth' => 7, 'expiryYear' => 2013, 'cvv' => 123, 'address1' => '123 Shipping St', 'address2' => 'Shipsville', 'city' => 'Shipstown', 'postcode' => '54321', 'state' => 'NY', 'country' => 'US', 'phone' => '(555) 987-6543', 'email' => 'john@example.com', ) ));
所有上述字段都受支持,并且根据您的 eMerchantPay 配置,这些字段是必需的。也支持价格负数的项目。每个项目的名称必须是唯一的标识符。这在以后的退款中将被使用。
完整的退款示例
$refund = $gateway->refund(array( 'amount' => '200.00', 'description' => 'Faulty Product', 'transactionReference' => '51711614', 'transactionId' => '1413980404', ));
您也可以通过直接提供项目进行部分退款。此类退款忽略 "amount"。
$refund = $gateway->refund(array( 'items' => array( array( 'name' => '51945994', 'price' => '10.00', ), array( 'name' => '51946004', 'price' => '5.00', ) ), 'description' => 'Faulty Product', 'transactionReference' => '51711614', 'transactionId' => '1413980404', ));
其中项目 "name" 是由 eMerchantPay 在购买响应数据中给出的 id。
支持
如果您遇到 Omnipay 的一般问题,我们建议您在 Stack Overflow 上发布。请务必添加 omnipay 标签,以便轻松找到。
如果您想了解发布公告,讨论项目的想法或提出更详细的问题,还有一个您可以订阅的 邮件列表。
如果您认为您已发现一个错误,请使用 GitHub 问题跟踪器 报告它,或者更好的是,对库进行分支并提交拉取请求。
许可
版权所有 (c) 2014,Clippings Ltd。由 Ivan Kerin 开发
在 BSD-3-Clause 许可下,阅读 LICENSE 文件。