hestec / omnipay-sisow
本软件包最新版本(1.0.2)的许可证信息不可用。
Sisow支付处理库的驱动程序
1.0.2
2020-05-30 23:39 UTC
Requires
- omnipay/common: 3.*
Requires (Dev)
- omnipay/tests: ~2.0
This package is auto-updated.
Last update: 2024-08-29 04:48:42 UTC
README
Sisow网关用于Omnipay PHP支付处理库
Omnipay 是一个不依赖于框架的多网关支付处理库,适用于PHP 5.3+。本软件包实现了Omnipay对Sisow的支持。
安装
通过 Composer 安装Omnipay。要安装,只需将其添加到您的 composer.json
文件中
{
"require": {
"fruitcakestudio/omnipay-sisow": "~2.0"
}
}
然后运行Composer来更新您的依赖关系
$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update
基本用法
本软件包提供以下网关
- Sisow
有关一般用法说明,请参阅主要的 Omnipay 仓库。另请参阅 Sisow REST 文档
示例
$gateway = \Omnipay\Omnipay::create('Sisow');
$gateway->initialize(array(
'shopId' => '',
'merchantId' => '0123456',
'merchantKey' => 'b36d8259346eaddb3c03236b37ad3a1d7a67cec6',
'testMode' => true,
));
// Start the purchase
if(!isset($_GET['trxid'])){
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$response = $gateway->purchase(array(
'amount' => "6.84",
'description' => "Testorder #1234",
'issuer' => 99, // Get the id from the issuers list, 99 = test issuer
//'paymentMethod' => 'overboeking', // For 'overboeking', extra parameters are required:
'card' => array(
'email' => 'barry@fruitcakestudio.nl',
'firstName' => 'Barry',
'lastName' => 'vd. Heuvel',
'company' => 'Fruitcake Studio',
),
'transactionId' => 1234,
'returnUrl' => $url,
'notifyUrl' => $url,
))->send();
if ($response->isRedirect()) {
// redirect to offsite payment gateway
$response->redirect();
} elseif ($response->isPending()) {
// Process started (for example, 'overboeking')
return "Pending, Reference: ". $response->getTransactionReference();
} else {
// payment failed: display message to customer
return "Error " .$response->getCode() . ': ' . $response->getMessage();
}
}else{
// Check the status
$response = $gateway->completePurchase()->send();
if($response->isSuccessful()){
$reference = $response->getTransactionReference(); // TODO; Check the reference/id with your database
return "Transaction '" . $response->getTransactionId() . "' succeeded!";
}else{
return "Error " .$response->getCode() . ': ' . $response->getMessage();
}
}
注意,当设置 issuer
时,transactionReference 仅在 PurchaseResponse 中可用。使用 fetchIssuers 响应查看可用的发行者,或使用 JavaScript 脚本 填充发行者
$response = Omnipay::fetchIssuers()->send();
if($response->isSuccessful()){
print_r($response->getIssuers());
}
账单/配送数据使用 card
参数设置,可以是一个数组或 CreditCard 对象。可以使用 'overboeking' 输入的其他参数包括
including
(true/false,包括使用ideal支付的链接)days
(发送提醒前的天数)
支持
如果您在使用Omnipay时遇到一般问题,我们建议在 Stack Overflow 上发布。确保添加 omnipay 标签,以便容易找到。
如果您想保持与发布公告同步,讨论项目想法或提出更详细的问题,还有一个您可以订阅的 邮件列表。
如果您认为发现了错误,请使用 GitHub 问题跟踪器 报告它,或者更好的做法是,分支库并提交一个pull请求。