first commit
This commit is contained in:
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
class alipayg_plugin
|
||||
{
|
||||
static public $info = [
|
||||
'name' => 'alipayg', //支付插件英文名称,需和目录名称一致,不能有重复
|
||||
'showname' => '支付宝国际版', //支付插件显示名称
|
||||
'author' => '支付宝', //支付插件作者
|
||||
'link' => 'https://global.alipay.com/', //支付插件作者链接
|
||||
'types' => ['alipay'], //支付插件支持的支付方式,可选的有alipay,qqpay,wxpay,bank
|
||||
'inputs' => [ //支付插件要求传入的参数以及参数显示名称,可选的有appid,appkey,appsecret,appurl,appmchid
|
||||
'appid' => [
|
||||
'name' => 'Partner ID',
|
||||
'type' => 'input',
|
||||
'note' => '',
|
||||
],
|
||||
'appkey' => [
|
||||
'name' => 'MD5 Key',
|
||||
'type' => 'input',
|
||||
'note' => '',
|
||||
],
|
||||
'appswitch' => [
|
||||
'name' => '支付时选择钱包类型',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'0' => '否',
|
||||
'1' => '是',
|
||||
],
|
||||
],
|
||||
],
|
||||
'select' => [ //选择已开启的支付方式
|
||||
'1' => 'PC支付',
|
||||
'2' => 'WAP支付',
|
||||
'3' => 'APP支付',
|
||||
],
|
||||
'note' => '支付时选择钱包类型开启后,支付时可选择Alipay或AlipayHK,关闭则默认使用Alipay', //支付密钥填写说明
|
||||
'bindwxmp' => false, //是否支持绑定微信公众号
|
||||
'bindwxa' => false, //是否支持绑定微信小程序
|
||||
];
|
||||
|
||||
static private $trade_information = ['business_type'=>'5','other_business_type'=>'在线充值'];
|
||||
|
||||
static public function submit(){
|
||||
global $siteurl, $channel, $order, $ordername, $sitename, $submit2, $conf;
|
||||
|
||||
if(checkwechat()){
|
||||
if(!$submit2){
|
||||
return ['type'=>'jump','url'=>'/pay/submit/'.TRADE_NO.'/'];
|
||||
}
|
||||
return ['type'=>'page','page'=>'wxopen'];
|
||||
}
|
||||
|
||||
return ['type'=>'jump','url'=>'/pay/alipay/'.TRADE_NO.'/'];
|
||||
}
|
||||
|
||||
static public function alipay(){
|
||||
global $channel, $order, $cdnpublic, $siteurl;
|
||||
|
||||
if($channel['appswitch'] == 1 && empty($_GET['type'])){
|
||||
include PAY_ROOT.'select.page.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
if(checkmobile()){
|
||||
if(in_array('2',$channel['apptype'])){
|
||||
return self::wappay();
|
||||
}elseif(in_array('1',$channel['apptype'])){
|
||||
return self::submitpc();
|
||||
}elseif(in_array('3',$channel['apptype'])){
|
||||
if(checkalipay()){
|
||||
return self::apppay();
|
||||
}else{
|
||||
$code_url = $siteurl.'pay/apppay/'.TRADE_NO.'/?type='.$_GET['type'];
|
||||
return ['type'=>'qrcode','page'=>'alipay_qrcode','url'=>$code_url];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(in_array('1',$channel['apptype'])){
|
||||
$code_url = '/pay/submitpc/'.TRADE_NO.'/?type='.$_GET['type'];
|
||||
return ['type'=>'qrcode','page'=>'alipay_qrcodepc','url'=>$code_url];
|
||||
}elseif(in_array('2',$channel['apptype'])){
|
||||
$code_url = $siteurl.'pay/wappay/'.TRADE_NO.'/?type='.$_GET['type'];
|
||||
return ['type'=>'qrcode','page'=>'alipay_qrcode','url'=>$code_url];
|
||||
}elseif(in_array('3',$channel['apptype'])){
|
||||
$code_url = $siteurl.'pay/apppay/'.TRADE_NO.'/?type='.$_GET['type'];
|
||||
return ['type'=>'qrcode','page'=>'alipay_qrcode','url'=>$code_url];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static public function submitpc(){
|
||||
global $siteurl, $channel, $order, $ordername, $sitename, $conf;
|
||||
|
||||
$alipay_config = require(PAY_ROOT.'inc/config.php');
|
||||
require(PAY_ROOT."inc/AlipayGlobalClient.php");
|
||||
|
||||
$parameter = array(
|
||||
'service' => 'create_forex_trade',
|
||||
'partner' => trim($alipay_config['partner']),
|
||||
'notify_url' => $conf['localurl'].'pay/notify/'.TRADE_NO.'/',
|
||||
'return_url' => $siteurl.'pay/return/'.TRADE_NO.'/',
|
||||
'out_trade_no' => TRADE_NO,
|
||||
'subject' => $ordername,
|
||||
'currency' => 'HKD',
|
||||
'rmb_fee' => $order['realmoney'],
|
||||
'refer_url' => $siteurl,
|
||||
'product_code' => 'NEW_WAP_OVERSEAS_SELLER',
|
||||
'qr_pay_mode' => '4',
|
||||
'qrcode_width' => '230',
|
||||
'trade_information' => json_encode(self::$trade_information),
|
||||
'_input_charset' => 'utf-8'
|
||||
);
|
||||
if(!empty($_GET['type'])){
|
||||
$parameter['payment_inst'] = trim($_GET['type']);
|
||||
}
|
||||
|
||||
$client = new AlipayGlobalClient($alipay_config);
|
||||
if(checkmobile() && !checkalipay()){
|
||||
try{
|
||||
$url = $client->buildRequestForm($parameter, 'REDIRECT');
|
||||
$html = get_curl($url, 0, 0, 0, 0, 0, 0, 0, 1);
|
||||
$html = mb_convert_encoding($html, 'utf-8', 'gbk');
|
||||
}catch(Exception $e){
|
||||
return ['type'=>'error','msg'=>$e->getMessage()];
|
||||
}
|
||||
if(preg_match('!<input name="qrCode" type="hidden" value="(.*?)"!i', $html, $match)){
|
||||
$code_url = $match[1];
|
||||
return ['type'=>'qrcode','page'=>'alipay_qrcode','url'=>$code_url];
|
||||
}else{
|
||||
return ['type'=>'error','msg'=>'支付宝下单失败!获取二维码失败'];
|
||||
}
|
||||
}else{
|
||||
$html_text = $client->buildRequestForm($parameter);
|
||||
$html_text = '<!DOCTYPE html><html><body><style>body{margin:0;padding:0}.waiting{position:absolute;width:100%;height:100%;background:#fff url(/assets/img/load.gif) no-repeat fixed center/80px;}</style><div class="waiting"></div>'.$html_text.'</body></html>';
|
||||
return ['type'=>'html','data'=>$html_text];
|
||||
}
|
||||
}
|
||||
|
||||
static public function wappay(){
|
||||
global $siteurl, $channel, $order, $ordername, $sitename, $conf;
|
||||
|
||||
$alipay_config = require(PAY_ROOT.'inc/config.php');
|
||||
require(PAY_ROOT."inc/AlipayGlobalClient.php");
|
||||
|
||||
$parameter = array(
|
||||
'service' => 'create_forex_trade_wap',
|
||||
'partner' => trim($alipay_config['partner']),
|
||||
'notify_url' => $conf['localurl'].'pay/notify/'.TRADE_NO.'/',
|
||||
'return_url' => $siteurl.'pay/return/'.TRADE_NO.'/',
|
||||
'out_trade_no' => TRADE_NO,
|
||||
'subject' => $ordername,
|
||||
'currency' => 'HKD',
|
||||
'rmb_fee' => $order['realmoney'],
|
||||
'refer_url' => $siteurl,
|
||||
'product_code' => 'NEW_WAP_OVERSEAS_SELLER',
|
||||
'trade_information' => json_encode(self::$trade_information),
|
||||
'_input_charset' => 'utf-8'
|
||||
);
|
||||
if(!empty($_GET['type'])){
|
||||
$parameter['payment_inst'] = trim($_GET['type']);
|
||||
}
|
||||
|
||||
$client = new AlipayGlobalClient($alipay_config);
|
||||
$html_text = $client->buildRequestForm($parameter);
|
||||
return ['type'=>'html','data'=>$html_text];
|
||||
}
|
||||
|
||||
static public function apppay(){
|
||||
global $siteurl, $channel, $order, $ordername, $sitename, $conf, $method;
|
||||
|
||||
$alipay_config = require(PAY_ROOT.'inc/config.php');
|
||||
require(PAY_ROOT."inc/AlipayGlobalClient.php");
|
||||
|
||||
$parameter = array(
|
||||
'service' => 'mobile.securitypay.pay',
|
||||
'partner' => trim($alipay_config['partner']),
|
||||
'notify_url' => $conf['localurl'].'pay/notify/'.TRADE_NO.'/',
|
||||
'return_url' => $siteurl.'pay/return/'.TRADE_NO.'/',
|
||||
'out_trade_no' => TRADE_NO,
|
||||
'subject' => $ordername,
|
||||
'payment_type' => '1',
|
||||
'seller_id' => trim($alipay_config['partner']),
|
||||
'currency' => 'HKD',
|
||||
'rmb_fee' => $order['realmoney'],
|
||||
'forex_biz' => 'FP',
|
||||
'refer_url' => $siteurl,
|
||||
'product_code' => 'NEW_WAP_OVERSEAS_SELLER',
|
||||
'trade_information' => json_encode(self::$trade_information),
|
||||
'_input_charset' => 'utf-8'
|
||||
);
|
||||
if(!empty($_GET['type'])){
|
||||
$parameter['payment_inst'] = trim($_GET['type']);
|
||||
}
|
||||
|
||||
$client = new AlipayGlobalClient($alipay_config);
|
||||
$result = $client->buildSdkParam($parameter);
|
||||
if($method == 'app'){
|
||||
return ['type'=>'app','data'=>$result];
|
||||
}
|
||||
if($_GET['d']=='1'){
|
||||
$redirect_url='data.backurl';
|
||||
}else{
|
||||
$redirect_url='\'/pay/ok/'.TRADE_NO.'/\'';
|
||||
}
|
||||
$code_url = 'alipays://platformapi/startApp?appId=20000125&orderSuffix='.urlencode($result).'#Intent;scheme=alipays;package=com.eg.android.AlipayGphone;end';
|
||||
return ['type'=>'page','page'=>'alipay_h5','data'=>['code_url'=>$code_url, 'redirect_url'=>$redirect_url]];
|
||||
}
|
||||
|
||||
//异步回调
|
||||
static public function notify(){
|
||||
global $channel, $order;
|
||||
|
||||
$alipay_config = require(PAY_ROOT.'inc/config.php');
|
||||
require(PAY_ROOT."inc/AlipayGlobalClient.php");
|
||||
|
||||
//计算得出通知验证结果
|
||||
$client = new AlipayGlobalClient($alipay_config);
|
||||
$verify_result = $client->verify($_POST);
|
||||
|
||||
if($verify_result) {//验证成功
|
||||
//商户订单号
|
||||
$out_trade_no = $_POST['out_trade_no'];
|
||||
|
||||
//支付宝交易号
|
||||
$trade_no = $_POST['trade_no'];
|
||||
|
||||
//买家支付宝
|
||||
$buyer_id = $_POST['buyer_id'];
|
||||
|
||||
//交易金额
|
||||
$total_fee = $_POST['total_fee'];
|
||||
|
||||
if ($_POST['trade_status'] == 'TRADE_FINISHED' || $_POST['trade_status'] == 'TRADE_SUCCESS') {
|
||||
if($out_trade_no == TRADE_NO){
|
||||
processNotify($order, $trade_no, $buyer_id);
|
||||
}
|
||||
}
|
||||
return ['type'=>'html','data'=>'success'];
|
||||
}
|
||||
else {
|
||||
//验证失败
|
||||
return ['type'=>'html','data'=>'fail'];
|
||||
}
|
||||
}
|
||||
|
||||
//同步回调
|
||||
static public function return(){
|
||||
global $channel, $order;
|
||||
|
||||
$alipay_config = require(PAY_ROOT.'inc/config.php');
|
||||
require(PAY_ROOT."inc/AlipayGlobalClient.php");
|
||||
|
||||
//计算得出通知验证结果
|
||||
$client = new AlipayGlobalClient($alipay_config);
|
||||
$verify_result = $client->verify($_GET);
|
||||
if($verify_result) {
|
||||
//商户订单号
|
||||
$out_trade_no = $_GET['out_trade_no'];
|
||||
|
||||
//支付宝交易号
|
||||
$trade_no = $_GET['trade_no'];
|
||||
|
||||
//买家支付宝
|
||||
$buyer_id = $_GET['buyer_id'];
|
||||
|
||||
//交易金额
|
||||
$total_fee = $_GET['total_fee'];
|
||||
|
||||
if($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') {
|
||||
if($out_trade_no == TRADE_NO){
|
||||
processReturn($order, $trade_no, $buyer_id);
|
||||
}else{
|
||||
return ['type'=>'error','msg'=>'订单信息校验失败'];
|
||||
}
|
||||
}else{
|
||||
return ['type'=>'error','msg'=>'trade_status='.$_GET['trade_status']];
|
||||
}
|
||||
}
|
||||
else {
|
||||
//验证失败
|
||||
return ['type'=>'error','msg'=>'签名验证失败!'];
|
||||
}
|
||||
}
|
||||
|
||||
//退款
|
||||
static public function refund($order){
|
||||
global $channel;
|
||||
if(empty($order))exit();
|
||||
|
||||
$alipay_config = require(PAY_ROOT.'inc/config.php');
|
||||
require(PAY_ROOT."inc/AlipayGlobalClient.php");
|
||||
|
||||
$params = [
|
||||
'service' => 'forex_refund',
|
||||
'partner' => trim($alipay_config['partner']),
|
||||
'out_return_no' => $order['refund_no'],
|
||||
'out_trade_no' => $order['trade_no'],
|
||||
'return_rmb_amount' => $order['refundmoney'],
|
||||
'currency' => 'HKD',
|
||||
'gmt_return' => date('Y-m-d H:i:s'),
|
||||
'_input_charset' => 'utf-8'
|
||||
];
|
||||
$client = new AlipayGlobalClient($alipay_config);
|
||||
$result = $client->sendRequest($params);
|
||||
if(isset($result['is_success']) && $result['is_success'] == 'T'){
|
||||
return ['code'=>0];
|
||||
}elseif(isset($result['error'])){
|
||||
return ['code'=>1,'msg'=>$result['error']];
|
||||
}else{
|
||||
return ['code'=>1,'msg'=>'未知错误'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @see https://global.alipay.com/docs/ac/legacy/legacydoc
|
||||
*/
|
||||
class AlipayGlobalClient
|
||||
{
|
||||
private $gateway_url = 'https://intlmapi.alipay.com/gateway.do';
|
||||
private $partner;
|
||||
private $key;
|
||||
private $private_key;
|
||||
private $ali_public_key;
|
||||
private $sign_type = 'MD5';
|
||||
private $input_charset = 'utf-8';
|
||||
|
||||
public function __construct($alipay_config)
|
||||
{
|
||||
$this->partner = $alipay_config['partner'];
|
||||
if(!empty($alipay_config['sign_type'])){
|
||||
$this->sign_type = $alipay_config['sign_type'];
|
||||
}
|
||||
if($this->sign_type == 'RSA'){
|
||||
$this->private_key = $alipay_config['private_key'];
|
||||
$this->ali_public_key = $alipay_config['ali_public_key'];
|
||||
}else{
|
||||
$this->key = $alipay_config['key'];
|
||||
}
|
||||
if(!empty($alipay_config['gateway_url'])){
|
||||
$this->gateway_url = $alipay_config['gateway_url'];
|
||||
}
|
||||
}
|
||||
|
||||
public function buildRequestForm($params, $method = 'POST'){
|
||||
$data = $this->buildRequestParam($params);
|
||||
|
||||
if($method == 'REDIRECT'){
|
||||
$requestUrl = $this->gateway_url.'?'.http_build_query($data);
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $requestUrl);
|
||||
curl_setopt($ch, CURLOPT_FAILONERROR, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
$response = curl_exec($ch);
|
||||
if (curl_errno($ch) > 0) {
|
||||
$errmsg = curl_error($ch);
|
||||
curl_close($ch);
|
||||
throw new Exception($errmsg, 0);
|
||||
}
|
||||
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
if ($httpStatusCode == 301 || $httpStatusCode == 302) {
|
||||
$redirect_url = curl_getinfo($ch, CURLINFO_REDIRECT_URL);
|
||||
curl_close($ch);
|
||||
return $redirect_url;
|
||||
} elseif ($httpStatusCode == 200) {
|
||||
curl_close($ch);
|
||||
$response = mb_convert_encoding($response, 'UTF-8', 'GB2312');
|
||||
if(preg_match('/<div\s+class="Todo">([^<]+)<\/div>/i', $response, $matchers)) {
|
||||
throw new Exception($matchers[1]);
|
||||
}
|
||||
}
|
||||
throw new Exception('返回数据解析失败', $httpStatusCode);
|
||||
}
|
||||
|
||||
$url = $this->gateway_url.'?_input_charset='.$this->input_charset;
|
||||
|
||||
$html = "<form id='alipaysubmit' name='alipaysubmit' action='{$url}' method='".$method."'>";
|
||||
foreach ($data as $key => $value) {
|
||||
$value = htmlentities($value, ENT_QUOTES | ENT_HTML5);
|
||||
$html .= "<input type='hidden' name='{$key}' value='{$value}'/>";
|
||||
}
|
||||
$html .= "<input type='submit' value='ok' style='display:none;'></form>";
|
||||
$html .= "<script>document.forms['alipaysubmit'].submit();</script>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function sendRequest($params){
|
||||
$data = $this->buildRequestParam($params);
|
||||
$url = $this->gateway_url.'?_input_charset='.$this->input_charset;
|
||||
$response = $this->curl($url, http_build_query($data));
|
||||
$arr = $this->xml2array($response);
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public function buildSdkParam($params){
|
||||
$data = $this->buildRequestParam($params);
|
||||
return http_build_query($data);
|
||||
}
|
||||
|
||||
public function verify($param){
|
||||
if(!isset($param['sign'])) return false;
|
||||
$sign = $param['sign'];
|
||||
$signstr = $this->getSignContent($param);
|
||||
if($this->sign_type == 'MD5'){
|
||||
$mysign = md5($signstr . $this->key);
|
||||
return $mysign === $sign;
|
||||
}else{
|
||||
return $this->rsaPubilcVerify($signstr, $sign, $this->sign_type);
|
||||
}
|
||||
}
|
||||
|
||||
private function buildRequestParam($param){
|
||||
$param['sign'] = $this->getSign($param);
|
||||
$param['sign_type'] = $this->sign_type;
|
||||
return $param;
|
||||
}
|
||||
|
||||
private function getSign($param){
|
||||
$signstr = $this->getSignContent($param);
|
||||
if($this->sign_type == 'MD5'){
|
||||
$sign = md5($signstr . $this->key);
|
||||
}else{
|
||||
$sign = $this->rsaPrivateSign($signstr, $this->sign_type);
|
||||
}
|
||||
return $sign;
|
||||
}
|
||||
|
||||
private function getSignContent($param){
|
||||
ksort($param);
|
||||
$signstr = '';
|
||||
foreach($param as $k => $v){
|
||||
if($k != "sign" && $k != "sign_type" && !$this->isEmpty($v)){
|
||||
$signstr .= $k.'='.$v.'&';
|
||||
}
|
||||
}
|
||||
$signstr = substr($signstr,0,-1);
|
||||
return $signstr;
|
||||
}
|
||||
|
||||
private function isEmpty($value)
|
||||
{
|
||||
return $value === null || trim($value) === '';
|
||||
}
|
||||
|
||||
private function xml2array($xml)
|
||||
{
|
||||
if (!$xml) {
|
||||
return false;
|
||||
}
|
||||
LIBXML_VERSION < 20900 && libxml_disable_entity_loader(true);
|
||||
return json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA), JSON_UNESCAPED_UNICODE), true);
|
||||
}
|
||||
|
||||
public static function getMillisecond()
|
||||
{
|
||||
list($s1, $s2) = explode(' ', microtime());
|
||||
return sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
|
||||
}
|
||||
|
||||
//使用商户私钥签名
|
||||
private function rsaPrivateSign($data, $signType = 'RSA2'){
|
||||
$priKey = "-----BEGIN RSA PRIVATE KEY-----\n" .
|
||||
wordwrap($this->private_key, 64, "\n", true) .
|
||||
"\n-----END RSA PRIVATE KEY-----";
|
||||
$res = openssl_get_privatekey($priKey);
|
||||
if(!$res){
|
||||
throw new Exception('签名失败,商户私钥不正确');
|
||||
}
|
||||
|
||||
if($signType == 'RSA2'){
|
||||
openssl_sign($data, $sign, $res, OPENSSL_ALGO_SHA256);
|
||||
}else{
|
||||
openssl_sign($data, $sign, $res);
|
||||
}
|
||||
openssl_free_key($res);
|
||||
return base64_encode($sign);
|
||||
}
|
||||
|
||||
//使用支付宝公钥验签
|
||||
private function rsaPubilcVerify($data, $sign, $signType = 'RSA2'){
|
||||
$pubKey = "-----BEGIN PUBLIC KEY-----\n" .
|
||||
wordwrap($this->ali_public_key, 64, "\n", true) .
|
||||
"\n-----END PUBLIC KEY-----";
|
||||
$res = openssl_get_publickey($pubKey);
|
||||
if(!$res){
|
||||
throw new Exception('验签失败,支付宝公钥不正确');
|
||||
}
|
||||
|
||||
if($signType == 'RSA2'){
|
||||
$result = openssl_verify($data, base64_decode($sign), $res, OPENSSL_ALGO_SHA256);
|
||||
}else{
|
||||
$result = openssl_verify($data, base64_decode($sign), $res);
|
||||
}
|
||||
openssl_free_key($res);
|
||||
return $result === 1;
|
||||
}
|
||||
|
||||
private function curl($url, $post = false, $timeout = 10){
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
$httpheader[] = "Accept: */*";
|
||||
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
|
||||
$httpheader[] = "Connection: close";
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
if($post){
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||||
}
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$alipay_config = [
|
||||
//PID
|
||||
'partner' => $channel['appid'],
|
||||
|
||||
//MD5密钥
|
||||
'key' => $channel['appkey'],
|
||||
|
||||
//签名方式
|
||||
'sign_type' => 'MD5',
|
||||
];
|
||||
return $alipay_config;
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
if(!defined('IN_PLUGIN'))exit();?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="Content-Language" content="zh-cn">
|
||||
<meta name="renderer" content="webkit">
|
||||
<title>支付宝支付</title>
|
||||
<link href="/assets/css/alipay_pay.css?v=2" rel="stylesheet" media="screen">
|
||||
<style>
|
||||
.alipay-row{display:flex;justify-content:center;align-items:center;margin-top:35px}
|
||||
.alipay-col{margin:0 25px;text-align:center}
|
||||
.alipay-col p{margin:3px 0 10px;font-size:14px;color:#000}
|
||||
.alipay-logo{width:100px}
|
||||
.alipay-logo:hover{box-shadow:1px 3px 10px #888}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="body">
|
||||
<h1 class="mod-title">
|
||||
<span class="ico-wechat"></span><span class="text">支付宝支付</span>
|
||||
</h1>
|
||||
<div class="mod-ct">
|
||||
<div class="order">
|
||||
</div>
|
||||
<div class="amount">¥<?php echo $order['realmoney']?></div>
|
||||
<div style="margin-top: 30px">
|
||||
<div style="font-size:16px">请选择付款APP</div>
|
||||
<div style="font-size:14px;color:#999">Please select your wallet region</div>
|
||||
<div class="alipay-row">
|
||||
<div class="alipay-col">
|
||||
<a href="?type=ALIPAYCN"><img class="alipay-logo" src="https://payment.pa-sys.com/imgs/alipay-cn-20240905.png">
|
||||
<p>支付宝(中国)</p></a>
|
||||
</div>
|
||||
<div class="alipay-col">
|
||||
<a href="?type=ALIPAYHK"><img class="alipay-logo" src="https://payment.pa-sys.com/imgs/alipay-hk-20240905.png">
|
||||
<p>AlipayHK</p></a>
|
||||
</div>
|
||||
</div>
|
||||
<div></div>
|
||||
</div>
|
||||
<div class="detail detail-open" id="orderDetail">
|
||||
<dl class="detail-ct">
|
||||
<dt>购买物品</dt>
|
||||
<dd id="productName"><?php echo $order['name']?></dd>
|
||||
<dt>商户订单号</dt>
|
||||
<dd id="billId"><?php echo $order['trade_no']?></dd>
|
||||
<dt>创建时间</dt>
|
||||
<dd id="createTime"><?php echo $order['addtime']?></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="tip">
|
||||
<span class="dec dec-left"></span>
|
||||
<span class="dec dec-right"></span>
|
||||
</div>
|
||||
<div class="tip-text">
|
||||
</div>
|
||||
</div>
|
||||
<script src="<?php echo $cdnpublic?>jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="<?php echo $cdnpublic?>layer/3.1.1/layer.min.js"></script>
|
||||
<script src="<?php echo $cdnpublic?>jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
|
||||
<script>
|
||||
function loadmsg() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "/getshop.php",
|
||||
data: {type: "alipay", trade_no: "<?php echo $order['trade_no']?>"},
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
layer.msg('支付成功,正在跳转中...', {icon: 16,shade: 0.1,time: 15000});
|
||||
setTimeout(window.location.href=data.backurl, 1000);
|
||||
}else{
|
||||
setTimeout("loadmsg()", 2000);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
setTimeout("loadmsg()", 2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
window.onload = function(){
|
||||
setTimeout("loadmsg()", 2000);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user