源码都有在线演示,联系客服索要演示账号和密码,购买充值,请联系客服
- 商品描述
-
一、授权域名【公众号设置->功能设置】 https://mp.weixin.qq.com
二、支付路径【产品中心->开发配置】 https://pay.weixin.qq.com/index.php/extend/pay_setting
三、在 https://mp.weixin.qq.com【基本设置】获取开发者ID(AppID)、开发者密码(AppSecret)
四、商户ID(MCHID):https://pay.weixin.qq.com/index.php/core/account/info
五、API密钥key 你填写的微信支付路径就是你看到微信支付按钮的当前链接
第一步:数据库配置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' => 'XXX@126.com', // 加密key,开通支付宝账户后给予 'key' => 'xxx', // 合作者ID,支付宝有该配置,开通易宝账户后给予 'partner' => 'XXX', //收款支付宝账号,以2088开头由16位纯数字组成的字符串,一般情况下收款账号就是签约账号 'seller_id' => 'XXX', //签名方式 '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' => 'XXX', 'MCHID' => 'XXX', 'KEY' => 'XXX', 'APPSECRET' => 'XXX', ), ) );
微信浏览器支付宝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 lipay_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 = '<iframe src="' . $html_text . '" name="iframepage" id="iframepage" scrolling="no" frameborder="0"></iframe>'; $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;
- 购买记录