php 公众号内h5支付宝支付宝支付宝支付宝支付,微信浏览器中支付宝wap支付和微信JSAPI公众号支付...

手机浏览器只有支付宝wap支付,微信浏览器中出现支付宝wap支付和微信JSAPI公众号支付,其中支付宝wap在线支付没有在新窗口打开(兼容大部分手机),Thinkphp3.2公众号支付

687be69bc8ab7311e05b513daee192c0.png

下载资源

下载积分:

998

积分

授权域名【公众号设置->功能设置】 https://mp.weixin.qq.com

233ba3724951e8f9542dc6e6af4bbd17.png

支付路径【产品中心->开发配置】 https://pay.weixin.qq.com/index.php/extend/pay_setting

908e143bede8e08f0ad4f9f364f3af94.png

在 https://mp.weixin.qq.com【基本设置】获取开发者ID(AppID)、开发者密码(AppSecret)

bcd2d8a2d13ca4e324c30882ff93e875.png

商户ID(MCHID):https://pay.weixin.qq.com/index.php/core/account/info

8840837468dd8b527c9a803852a41ebf.png

API密钥key

cf1107dd75e23c416941e1cc1695f5e3.png

你填写的微信支付路径就是你看到微信支付按钮的当前链接

第一步:数据库配置Application/common/conf/config.php $host = $_SERVER['HTTP_HOST'];

$arr = array(

'DB_TYPE' => 'mysql',

'DB_HOST' => "localhost",

'DB_NAME' => 'demo',

'DB_USER' => "root",

'DB_PWD' => "root",

'DB_PORT' => 3306,

'DB_PREFIX' => '',

'DB_CHARSET' => 'utf8',

);

第二步:配置支付信息Application/Home/conf/config.php $arr = array(

'URL_ROUTER_ON' => true,

/* 支付设置 */

'payment' => array(

'alipay' => array(

// 收款账号邮箱

'email' => 'xuanhani@126.com',

// 加密key,开通支付宝账户后给予

'key' => 'ggo084pb84gl43qnw82a39n9b7r1jq2m',

// 合作者ID,支付宝有该配置,开通易宝账户后给予

'partner' => '2088901006538525',

//收款支付宝账号,以2088开头由16位纯数字组成的字符串,一般情况下收款账号就是签约账号

'seller_id' => '2088901006538525',

//签名方式

'sign_type' => strtoupper('MD5'),

//字符编码格式 目前支持utf-8

'input_charset' => strtolower('utf-8'),

// 产品类型,无需修改

'service' => 'alipay.wap.create.direct.pay.by.user',

// 支付类型 ,无需修改

'payment_type' => '1',

),

'wechatjspai' => array(

'APPID' => 'wx4221260b6bbfcfc',

'MCHID' => '1349825901',

'KEY' => '2088901006538525',

'APPSECRET' => '45843e705995a12106155f4c26f716dc',

),

)

);

微信浏览器支付宝wap支付 public function alipay_jump($data) {

header("Content-type: text/html; charset=utf-8");

require dirname(dirname(dirname(__FILE__))) . '/Common/Org/zfbPay/alipay.config.php';

require dirname(dirname(dirname(__FILE__))) . '/Common/Org/zfbPay/lib/alipay_submit.class.php';

#获取支付配置信息

$alipay_config = C('payment.alipay');

//构造要请求的参数数组,无需改动

$parameter = array(

"service" => $alipay_config['service'],

"partner" => $alipay_config['partner'],

"seller_id" => $alipay_config['seller_id'],

"payment_type" => $alipay_config['payment_type'],

"notify_url" => $data['url_notify'],

"return_url" => $data['url_return'],

"_input_charset" => $alipay_config['input_charset'],

"out_trade_no" => $data['order_no'],

"subject" => $data['title'],

"total_fee" => $data['order_money'],

"show_url" => $data['url_return'],

//"app_pay" => "Y",//启用此参数能唤起钱包APP支付宝

"body" => $data['body'],

//其他业务参数根据在线开发文档,添加参数.文档地址:https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7629140.0.0.2Z6TSk&treeId=60&articleId=103693&docType=1

//如"参数名" => "参数值" 注:上一个参数末尾需要“,”逗号。

);

//建立请求

$alipaySubmit = new \alipay_submit($alipay_config);

#判断是微信浏览器支付还是非微信浏览器支付

$is_weixin = is_weixin();

if ($is_weixin == 0) {

$html_text = $alipaySubmit->buildRequestForm($parameter, "get", "确认");

echo $html_text;

} else {

$html_text = $alipaySubmit->getHtml($parameter);

$content = '';

$this->assign('content', $content);

$this->display('pay');

}

}

支付宝和微信通知回调 public function pay_weixin() {

$simple = json_decode(json_encode(simplexml_load_string($GLOBALS['HTTP_RAW_POST_DATA'], 'SimpleXMLElement', LIBXML_NOCDATA)), true);

$notify_data['order_no'] = $notify_data['trade_no'] = $simple['out_trade_no'];

$notify_data['third_id'] = $simple['transaction_id'];

$notify_data['pay_money'] = $simple['total_fee'];

$notify_data['payment_method'] = 'weixin';

// $sign = $simple['sign'];

// file_put_contents('ac_simple.txt', json_encode($simple));

// file_put_contents('ac_notify_data.txt', json_encode($notify_data));

$this->order_pay($notify_data);

}

public function pay_alipay() {

$notify_data['order_no'] = $notify_data['trade_no'] = I("post.out_trade_no");

$notify_data['third_id'] = I("post.trade_no");

$notify_data['pay_money'] = I("post.total_fee");

$notify_data['payment_method'] = 'alipay';

$this->order_pay($notify_data);

file_put_contents('ac_notify_data.txt', json_encode($_REQUEST));

}

压缩包里附带支付订单表 CREATE TABLE IF NOT EXISTS `order` (

`id` int(11) unsigned NOT NULL,

`order_no` varchar(30) NOT NULL,

`trade_no` varchar(150) DEFAULT NULL COMMENT '交易号',

`order_money` decimal(10,2) DEFAULT '0.00',

`unit_name` varchar(10) NOT NULL,

`pay_type` varchar(20) DEFAULT NULL COMMENT '支付方式',

`state` int(2) NOT NULL DEFAULT '0',

`addtime` int(10) NOT NULL,

`update_time` int(10) DEFAULT '0'

) ENGINE=MyISAM AUTO_INCREMENT=36 DEFAULT CHARSET=utf8;

2018-09-03 php服务端微信支付整理SDK,封装,如果喜欢请给个好评!谢谢 说明: 配置在 WeChatConfig文件下 环境:php5.6,基于tp5开发 调用统一下单接口: include_once EXTEND_PATH . 'WeChatSDK/WeChatSDK.php'; $data = $this->getOrderInfo($pay_sn); if (!$data) { return $this->resultCode(-2019, '订单不存在或已支付'); } $WeixinPay = new \WeChatSDK(); if ($trade_type == 'JSAPI') { //目前未有此功能 $openid = ''; $product_id = ''; } if ($trade_type == 'NATIVE') { $openid = ''; $product_id = $pay_sn; } if ($trade_type == 'MWEB') { $openid = ''; $product_id = $pay_sn; } if ($trade_type == 'APP') { $openid = ''; $product_id = $pay_sn; } $out_trade_no = $pay_sn; $result = $WeixinPay->setWeiXinPay($data['pay_body'], $data['pay_detail'], $data['pay_money'] * 100, $out_trade_no, $red_url, $trade_type, $openid, $product_id); APP加密:$WeChatSDK->GetAppParameters($result['data']); web编码 $WeChatSDK->GetMwebApiParameters(); jsapi:WeChatSDK-> GetJsApiParameters(); 回调调用: include_once EXTEND_PATH . 'WeChatSDK/WeChatSDK.php'; Log::write("gwgwgwgw---------------------------------进入异步回掉"); $postStr = file_get_contents('php://input'); Log::write("gwgwgwgw---------------------------------" . $postStr); $WeChatSDK = new \WeChatSDK(); if (!empty($postStr)) { $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); $check_sign = $WeChatSDK->checkSign($postObj, $postObj->sign); Log::write('-----check_sign-------' . $check_sign . '------------check_sign--------------'); if ($postObj->result_code == 'SUCCESS' && $check_sign == 1) { model('order', 'service')->affirmPayment($postObj->out_trade_no); $xml = "<xml> <![CDATA[SUCCESS]]></return_co
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值