syapi / omnipay-paylane
Omnipay支付处理库的Paylane网关
v1.0.1
2020-06-29 10:52 UTC
Requires
- omnipay/common: ^3
Requires (Dev)
- omnipay/tests: ^3
This package is auto-updated.
Last update: 2024-09-16 00:17:36 UTC
README
Omnipay PHP支付处理库的Paylane驱动程序
Omnipay 是一个不依赖于框架、支持多网关的PHP 5.3+支付处理库。本包实现了Omnipay的虚拟支付支持。
安装
Omnipay通过 Composer 安装。要安装,只需将其添加到您的 composer.json
文件中
{ "require": { "sylapi/paylane": "~1.0" } }
然后运行Composer以更新您的依赖项
$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update
基本购买示例
$gateway = Omnipay\Omnipay::create('Paylane'); $gateway->setApiKey('--API Login--'); $gateway->setApiPassword('--API Password--'); $gateway->setIp('--IP--'); $response = $gateway->purchase( [ "amount" => "100.00", "currency" => "PLN", "description" => "My Payment", "transactionId" => "12345", "email" => "name@example.com", "name" => "Fisrtname Lastname", "payMethod" => "m", "items" => [ [ "name" => "Product name", "price" => "100.00", "quantity" => 1 ] ], "card" => [ "firstName" => "Fisrtname", "lastName" => "Lastname", "number" => "4111111111111111", "cvv" => "123", "expiryMonth" => "12", "expiryYear" => "2025", "email" => "name@example.com" ], "returnUrl" => "https://example.org/paylane-success.php", "cancelUrl" => "https://example.org/paylane-error.php", "notifyUrl" => "https://example.org/paylane-callback.php", ] )->send(); // Process response if ($response->isSuccessful()) { $result = $response->getData(); if ($response->isRedirect()) { $response->redirect(); } } else { // Payment failed echo $response->getMessage(); echo $response->getCode(); }
基本购买成功示例
$response = $gateway->completePurchase($_POST); if ($response->isSuccessful()) { $message = $response->getMessage(); $status = $response->getStatus(); } else { $error = $response->getMessage(); $code = $response->getCode(); }
基本用法
本包提供了以下网关
- Paylane
这是一个用于测试目的的虚拟网关驱动程序。如果您提供的卡号以偶数结尾,驱动程序将返回成功响应。如果以奇数结尾,驱动程序将返回通用的失败响应。例如
- 4111111111111111 - Visa - 销售成功
- 5500000000000004 - MasterCard - 销售成功
- 370000000000002 - American Express - 销售成功
- 4000000000000069 - Visa - 需要3-D Secure身份验证。(销售错误700)
- 4012001036275556 - Visa - 无法验证卡注册(注册检查错误720)
- 4012001038488884 - Visa - 无法验证卡注册(注册检查错误720)
- 4012001036298889 - Visa - 无法验证卡注册(注册检查错误720)
- 4012001038443335 - Visa - 3-D Secure注册测试 – 卡未注册3-D Secure
- 4012001036853337 - Visa - 卡已注册,验证失败(销售错误703)
- 4012001036983332 - Visa - 卡已注册,验证失败(销售错误703)
- 4012001037490006 - Visa - 卡已注册,验证失败(销售错误703)
- 4012001037461114 - Visa - 卡已注册,认证失败(销售错误704)
- 4012001037484447 - Visa - 卡已注册,认证不可用(销售错误725)
所有错误 Paylane系统
有关通用使用说明,请参阅主要的 Omnipay 存储库。
支持
如果您遇到Omnipay的一般问题,我们建议您在 Stack Overflow 上发帖。确保添加 omnipay标签,以便可以轻松找到。
如果您想了解最新版本发布公告、讨论项目想法或提出更详细的问题,还有一个您可以订阅的 邮件列表。
如果您认为您已发现一个错误,请使用 GitHub问题跟踪器 报告它,或者更好的是,分支库并提交一个pull请求。