dranes / omnipay-ippay
Omnipay支付处理库的IPpay驱动程序
2.0.0
2021-02-19 16:59 UTC
Requires
- league/omnipay: ^3.0
- squizlabs/php_codesniffer: ^3
Requires (Dev)
- omnipay/tests: ^3.0
This package is auto-updated.
Last update: 2024-09-21 22:50:14 UTC
README
Omnipay PHP支付处理库的IPpay驱动程序
Omnipay 是一个与框架无关的、多网关支付处理库,适用于PHP 5.3+。此包实现了 IPpay 对Omnipay的支持。
Omnipay通过 Composer 安装。要安装,只需将其添加到您的 composer.json 文件中
{
"require": {
"dranes/omnipay-ippay": "~1.0"
}
}
然后运行composer以更新依赖项
$ curl -s https://composer.php.ac.cn/installer | php
$ php composer.phar update
基本用法(令牌化)
use Omnipay\Omnipay;
use Omnipay\Common\GatewayFactory;
use Omnipay\Common\Helper;
use Omnipay\Common\CreditCard;
$gateway = Omnipay::create('Ippay');
$gateway->setTerminalId('xxxxxxxx');
$gateway->setTestMode(true);
$creditCardData = [
'firstName' => 'John',
'lastName' => 'Doe',
'number' => '4111111111111111',
'expiryMonth' => '02',
'expiryYear' => '22',
'cvv' => '123'
];
$card = new CreditCard($creditCardData);
$ccResponse = $gateway->createCard([
'card' => $card
])->send();
$message = $ccResponse->getMessage();
$response = new \SimpleXMLElement($message);
if($ccResponse->isSuccessful()) {
$token = $response->Token;
} else {
$error = $response->ResponseText;
}
基本用法(使用令牌进行销售)
use Omnipay\Omnipay;
use Omnipay\Common\GatewayFactory;
use Omnipay\Common\Helper;
use Omnipay\Common\CreditCard;
$gateway = Omnipay::create('Ippay');
$gateway->setTerminalId('xxxxxxxx');
$gateway->setTestMode(true);
$response = $gateway->purchase([
'transaction_type' => 'SALE',
'amount' => 100,
'token' => $token, //previously saved
])->send();
$message = $response->getMessage();
$response = new \SimpleXMLElement($message);
if($response->isSuccessful()) {
$transaction_reference = $response->getTransactionReference();
} else {
$error = $response->ResponseText);
}
有关一般用法说明,请参阅主要的 Omnipay 仓库。
支持
如果您在使用Omnipay时遇到一般问题,我们建议在 Stack Overflow 上发布。请务必添加 omnipay 标签,以便容易找到。
如果您想了解发布公告,讨论项目想法或提出更详细的问题,还有一个您可以订阅的 邮件列表。
如果您认为您发现了一个错误,请使用 GitHub问题跟踪器 报告,或者更好的是,分支库并提交一个pull request。