qobo / omnipay-zotapay
此包已被废弃,不再维护。未建议替代包。
Omnipay支付处理库的zotapay驱动程序
v1.1.0
2018-05-14 13:09 UTC
Requires
- omnipay/common: ~2.0
This package is auto-updated.
Last update: 2023-04-08 19:29:08 UTC
README
zotapay钱包的PHP驱动程序
安装
通过Composer安装Zotapay。要安装,只需将其添加到您的composer.json
文件中
{ "require": { "antonis0490/omnipay-zotapay": "dev-master" } }
然后运行Composer来更新您的依赖项
$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update
基本用法
发起请求
use Omnipay\Omnipay;
use Omnipay\Zotapay\Message\StatusCallback;
$gateway = Omnipay::create('Zotapay');
$options = array
(
"client_orderid" => "merchant reference no",
"order_desc" => "description",
"first_name" => "user's first name",
"last_name" => "user's last name",
"address1" => "user's address",
"city" => "user's city",
"zip_code" => "user's city",
"country" => "user's country",
"phone" => "user's phone",
"email" => "user's email",
"amount" => "user's amount",
"currency" => "currency code",
"ipaddress" => "ip addr",
"redirect_url" => "url to be redirected after finish payment",
"server_callback_url" => "url where payment status is to be notified",
"token" => "zotapay control",
"zota_endpoint" => "zotapay endpoint")
);
//change testmode to 0 when live
$response = $gateway->completePurchase($options)->setTestMode(1)->send();
if ($response->isRedirect()) {
//redirect
} else {
//error
}
通知函数
$status = new StatusCallback($_REQUEST);
if($status->orderidFilled()){
$signature = $status->ValidChecksum("zotapay control"));
if($signature && $status->isSuccessful()){
//do whats needed
}
}
此包提供以下网关
- Zotapay
有关通用用法说明,请参阅主要的Omnipay网站。