当前位置: 首页>>代码示例>>PHP>>正文


PHP UnifiedOrder_pub::getPrepayId方法代码示例

本文整理汇总了PHP中UnifiedOrder_pub::getPrepayId方法的典型用法代码示例。如果您正苦于以下问题:PHP UnifiedOrder_pub::getPrepayId方法的具体用法?PHP UnifiedOrder_pub::getPrepayId怎么用?PHP UnifiedOrder_pub::getPrepayId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnifiedOrder_pub的用法示例。


在下文中一共展示了UnifiedOrder_pub::getPrepayId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildRequest

 public function buildRequest($req)
 {
     //获取prepay_id============
     $unifiedOrder = new UnifiedOrder_pub($this->wxConfig);
     //设置统一支付接口参数
     $unifiedOrder->setParameter("openid", "{$req['openId']}");
     //商品描述
     $unifiedOrder->setParameter("body", "{$req['body']}");
     //商品描述
     $unifiedOrder->setParameter("out_trade_no", "{$req['order_sn']}");
     //商户订单号
     $amount = $req['order_paied'] * 100;
     $unifiedOrder->setParameter("total_fee", "{$amount}");
     //总金额
     $unifiedOrder->setParameter("notify_url", $this->wxConfig['notify_url']);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     //非必填参数,商户可根据实际情况选填
     //$unifiedOrder->setParameter("sub_mch_id","XXXX");//子商户号
     //$unifiedOrder->setParameter("device_info","XXXX");//设备号
     //$unifiedOrder->setParameter("attach","XXXX");//附加数据
     //$unifiedOrder->setParameter("time_start","XXXX");//交易起始时间
     //$unifiedOrder->setParameter("time_expire","XXXX");//交易结束时间
     //$unifiedOrder->setParameter("goods_tag","XXXX");//商品标记
     //$unifiedOrder->setParameter("openid","XXXX");//用户标识
     //$unifiedOrder->setParameter("product_id","XXXX");//商品ID
     $prepay_id = $unifiedOrder->getPrepayId();
     //使用jsapi调起支付============
     $this->jsApi->setPrepayId($prepay_id);
     $this->jsApi = $this->jsApi->getParameters();
     return "<script>\n        function jsApiCall(){\n            WeixinJSBridge.invoke(\n                'getBrandWCPayRequest',\n                {$this->jsApi},\n                function(res){\n                    //支付成功\n                    if(res.err_msg == 'get_brand_wcpay_request:ok')\n                        window.location = '/ng/#/order';\n                    //用户取消\n                    else if(res.err_msg == 'get_brand_wcpay_request:cancel'){\n                        window.location = '/ng/#/order';\n                    }\n                    //支付失败\n                    else{\n                        alert('支付失败,请重试下');\n                        window.location = '/ng/#/order';\n                    }\n                }\n            );\n        }\n        ;(function(){\n            if (typeof WeixinJSBridge == 'undefined'){\n                if( document.addEventListener ){\n                    document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);\n                }else if (document.attachEvent){\n                    document.attachEvent('WeixinJSBridgeReady', jsApiCall);\n                    document.attachEvent('onWeixinJSBridgeReady', jsApiCall);\n                }\n            }else{\n                jsApiCall();\n            }\n            //监控关闭窗口\n            WeixinJSBridge.invoke('closeWindow',{},function(res){\n                window.location.href = '/ng/#/order';\n            });\n        })()</script>";
 }
开发者ID:nicklos17,项目名称:littlemall,代码行数:33,代码来源:MobiWechatClass.php

示例2: pay

 public function pay()
 {
     if (empty($this->pay_config['pay_weixin_appid']) || empty($this->pay_config['pay_weixin_mchid']) || empty($this->pay_config['pay_weixin_key'])) {
         return array('err_code' => 1, 'err_msg' => '微信支付缺少配置信息!请联系管理员处理或选择其他支付方式。');
     }
     if (empty($this->openid)) {
         return array('err_code' => 1, 'err_msg' => '没有获取到用户的微信资料,无法使用微信支付');
     }
     import('source.class.pay.Weixinnewpay.WxPayPubHelper');
     $jsApi = new JsApi_pub($this->pay_config['pay_weixin_appid'], $this->pay_config['pay_weixin_mchid'], $this->pay_config['pay_weixin_key']);
     $unifiedOrder = new UnifiedOrder_pub($this->pay_config['pay_weixin_appid'], $this->pay_config['pay_weixin_mchid'], $this->pay_config['pay_weixin_key']);
     $unifiedOrder->setParameter('openid', $this->openid);
     $unifiedOrder->setParameter('body', $this->order_info['order_no_txt']);
     $unifiedOrder->setParameter('out_trade_no', $this->order_info['trade_no']);
     $unifiedOrder->setParameter('total_fee', floatval($this->order_info['total'] * 100));
     $unifiedOrder->setParameter('notify_url', option('config.wap_site_url') . '/paynotice.php');
     $unifiedOrder->setParameter('trade_type', 'JSAPI');
     $unifiedOrder->setParameter('attach', 'weixin');
     $prepay_result = $unifiedOrder->getPrepayId();
     if ($prepay_result['return_code'] == 'FAIL') {
         return array('err_code' => 1, 'err_msg' => '没有获取微信支付的预支付ID,请重新发起支付!<br/><br/>微信支付错误返回:' . $prepay_result['return_msg']);
     }
     if ($prepay_result['err_code']) {
         return array('err_code' => 1, 'err_msg' => '没有获取微信支付的预支付ID,请重新发起支付!<br/><br/>微信支付错误返回:' . $prepay_result['err_code_des']);
     }
     $jsApi->setPrepayId($prepay_result['prepay_id']);
     return array('err_code' => 0, 'pay_data' => $jsApi->getParameters());
 }
开发者ID:fkssei,项目名称:pigcms10,代码行数:28,代码来源:Weixin.class.php

示例3: mobile_pay

 public function mobile_pay()
 {
     import('@.ORG.pay.Weixinnewpay.WxPayPubHelper');
     //使用jsapi接口
     $jsApi = new JsApi_pub($this->pay_config['pay_weixin_appid'], $this->pay_config['pay_weixin_mchid'], $this->pay_config['pay_weixin_key'], $this->pay_config['pay_weixin_appsecret']);
     //使用统一支付接口
     $unifiedOrder = new UnifiedOrder_pub($this->pay_config['pay_weixin_appid'], $this->pay_config['pay_weixin_mchid'], $this->pay_config['pay_weixin_key'], $this->pay_config['pay_weixin_appsecret']);
     $unifiedOrder->setParameter("openid", $_SESSION['openid']);
     //用户微信唯一标识
     $unifiedOrder->setParameter("body", $this->order_info['order_name'] . '_' . $this->order_info['order_num']);
     //商品描述
     //自定义订单号,此处仅作举例
     $unifiedOrder->setParameter("out_trade_no", $this->order_info['order_type'] . '_' . $this->order_info['order_id']);
     //商户订单号
     $unifiedOrder->setParameter("total_fee", floatval($this->pay_money * 100));
     //总金额
     $unifiedOrder->setParameter("notify_url", C('config.site_url') . '/source/wap_weixin_notice.php');
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     $unifiedOrder->setParameter("attach", 'weixin');
     //附加数据
     $prepay_result = $unifiedOrder->getPrepayId();
     if ($prepay_result['return_code'] == 'FAIL') {
         return array('error' => 1, 'msg' => '没有获取微信支付的预支付ID,请重新发起支付!微信支付错误返回:' . $prepay_result['return_msg']);
     }
     if ($prepay_result['err_code']) {
         return array('error' => 1, 'msg' => '没有获取微信支付的预支付ID,请重新发起支付!<br/><br/>微信支付错误返回:' . $prepay_result['err_code_des']);
     }
     //=========步骤3:使用jsapi调起支付============
     $jsApi->setPrepayId($prepay_result['prepay_id']);
     return array('error' => 0, 'weixin_param' => $jsApi->getParameters());
 }
开发者ID:belerweb,项目名称:pigcms,代码行数:33,代码来源:Weixin.class.php

示例4: config

 public function config($config = null)
 {
     if (empty($_SERVER['HTTP_USER_AGENT']) || strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') === false && strpos($_SERVER['HTTP_USER_AGENT'], 'Windows Phone') === false) {
         header('Location: ' . WEB_PATH . '/pay/wxpay_web_url/payinfo/nowechat');
         die;
     }
     include_once dirname(__FILE__) . "/wxpay/WxPayPubHelper.php";
     if (empty($config['pay_type_data'])) {
         $this->db = System::load_sys_class('model');
         $pay = $this->db->GetOne("SELECT * from `@#_pay` where `pay_class` = 'wxpay_web'");
         $config['pay_type_data'] = unserialize($pay['pay_key']);
     }
     WxPayConf_pub::$APPID = $config['pay_type_data']['APPID']['val'];
     WxPayConf_pub::$MCHID = $config['pay_type_data']['MCHID']['val'];
     WxPayConf_pub::$KEY = $config['pay_type_data']['KEY']['val'];
     WxPayConf_pub::$APPSECRET = $config['pay_type_data']['APPSECRET']['val'];
     $jsApi = new JsApi_pub();
     if (!isset($_GET['code'])) {
         $url = G_WEB_PATH . '/index.php/pay/wxpay_web_url/?money=' . $config['money'] . '&out_trade_no=' . $config['code'];
         $url = $jsApi->createOauthUrlForCode(urlencode($url));
         header("Location: {$url}");
         die;
     } else {
         $jsApi->setCode($_GET['code']);
         $openid = $jsApi->getOpenId();
     }
     //		var_dump($_GET);
     //		echo $openid;die;
     WxPayConf_pub::$SSLCERT_PATH = dirname(__FILE__) . '/cacert/apiclient_cert.pem';
     WxPayConf_pub::$SSLKEY_PATH = dirname(__FILE__) . '/cacert/apiclient_key.pem';
     //=========步骤2:使用统一支付接口,获取prepay_id============
     //使用统一支付接口
     $unifiedOrder = new UnifiedOrder_pub();
     //设置统一支付接口参数
     //设置必填参数
     //appid已填,商户无需重复填写
     //mch_id已填,商户无需重复填写
     //noncestr已填,商户无需重复填写
     //spbill_create_ip已填,商户无需重复填写
     //sign已填,商户无需重复填写
     $unifiedOrder->setParameter("openid", $openid);
     $unifiedOrder->setParameter("body", "购买商品");
     //商品描述
     $unifiedOrder->setParameter("out_trade_no", $config['code']);
     //商户订单号
     $unifiedOrder->setParameter("total_fee", $config['money'] * 100);
     //总金额
     $unifiedOrder->setParameter("notify_url", $config['NotifyUrl']);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     $prepay_id = $unifiedOrder->getPrepayId();
     //=========步骤3:使用jsapi调起支付============
     $jsApi->setPrepayId($prepay_id);
     $jsApiParameters = $jsApi->getParameters();
     include 'wxpay_web.html.php';
 }
开发者ID:ping199143,项目名称:1ydb,代码行数:57,代码来源:wxpay_web.class.php

示例5: new_pay

 public function new_pay()
 {
     import('@.ORG.Weixinnewpay.WxPayPubHelper');
     //使用jsapi接口
     $jsApi = new JsApi_pub($this->payConfig['new_appid'], $this->payConfig['mchid'], $this->payConfig['key'], $this->payConfig['appsecret']);
     //获取订单信息
     $orderid = $_GET['single_orderid'];
     $payHandel = new payHandle($this->token, $_GET['from'], 'weixin');
     $orderInfo = $payHandel->beforePay($orderid);
     $price = $orderInfo['price'];
     //判断是否已经支付过
     if ($orderInfo['paid']) {
         exit('您已经支付过此次订单!');
     }
     //=========步骤2:使用统一支付接口,获取prepay_id============
     //使用统一支付接口
     $unifiedOrder = new UnifiedOrder_pub($this->payConfig['new_appid'], $this->payConfig['mchid'], $this->payConfig['key'], $this->payConfig['appsecret']);
     $unifiedOrder->setParameter("openid", $_GET['wecha_id']);
     //商品描述
     $unifiedOrder->setParameter("body", $orderid);
     //商品描述
     //自定义订单号,此处仅作举例
     $unifiedOrder->setParameter("out_trade_no", $orderid);
     //商户订单号
     $unifiedOrder->setParameter("total_fee", $price * 100);
     //总金额
     if (strpos(CONF_PATH, 'DataPig')) {
         $noticeFileName = 'notice_datapig.php';
     } elseif (strpos(CONF_PATH, 'weimidata')) {
         $noticeFileName = 'notice_weimidata.php';
     } else {
         $noticeFileName = 'notice.php';
     }
     $unifiedOrder->setParameter("notify_url", C('site_url') . '/wxpay/' . $noticeFileName);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     $unifiedOrder->setParameter("attach", 'token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from']);
     //附加数据
     $prepay_id = $unifiedOrder->getPrepayId();
     if (empty($prepay_id)) {
         $this->error('没有获取到微信支付预支付ID,请管理员检查微信支付配置项!');
     }
     //=========步骤3:使用jsapi调起支付============
     $jsApi->setPrepayId($prepay_id);
     $jsApiParameters = $jsApi->getParameters();
     $this->assign('jsApiParameters', $jsApiParameters);
     $from = $_GET['from'];
     $from = $from ? $from : 'Groupon';
     $from = $from != 'groupon' ? $from : 'Groupon';
     $returnUrl = $this->siteUrl . '/index.php?g=Wap&m=' . $from . '&a=payReturn&nohandle=1&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&orderid=' . $orderid;
     $this->assign('returnUrl', $returnUrl);
     //$this->display();
     echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-status-bar-style" content="black" /><meta name="format-detection" content="telephone=no" /><link href="/tpl/Wap/default/common/css/style/css/hotels.css" rel="stylesheet" type="text/css" /><title>微信支付</title><script language="javascript">function callpay(){WeixinJSBridge.invoke("getBrandWCPayRequest",' . $jsApiParameters . ',function(res){WeixinJSBridge.log(res.err_msg);if(res.err_msg=="get_brand_wcpay_request:ok"){document.getElementById("payDom").style.display="none";document.getElementById("successDom").style.display="";setTimeout("window.location.href = \'' . $returnUrl . '\'",2000);}else{if(res.err_msg == "get_brand_wcpay_request:cancel"){var err_msg = "您取消了支付";}else if(res.err_msg == "get_brand_wcpay_request:fail"){var err_msg = "支付失败<br/>错误信息:"+res.err_desc;}else{var err_msg = res.err_msg +"<br/>"+res.err_desc;}document.getElementById("payDom").style.display="none";document.getElementById("failDom").style.display="";document.getElementById("failRt").innerHTML=err_msg;}});}</script></head><body style="padding-top:20px;"><style>.deploy_ctype_tip{z-index:1001;width:100%;text-align:center;position:fixed;top:50%;margin-top:-23px;left:0;}.deploy_ctype_tip p{display:inline-block;padding:13px 24px;border:solid #d6d482 1px;background:#f5f4c5;font-size:16px;color:#8f772f;line-height:18px;border-radius:3px;}</style><div id="payDom" class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付信息</span></li><li class="nob"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><th>金额</th><td>' . floatval($_GET['price']) . '元</td></tr></table></li></ul><div class="footReturn" style="text-align:center"><input type="button" style="margin:0 auto 20px auto;width:100%"  onclick="callpay()"  class="submit" value="点击进行微信支付" /></div></div><div id="failDom" style="display:none" class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付结果</span></li><li class="nob"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><th>支付失败</th><td><div id="failRt"></div></td></tr></table></li></ul><div class="footReturn" style="text-align:center"><input type="button" style="margin:0 auto 20px auto;width:100%"  onclick="callpay()"  class="submit" value="重新进行支付" /></div></div><div id="successDom" style="display:none" class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付成功</span></li><li class="nob"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><td>您已支付成功,页面正在跳转...</td></tr></table><div id="failRt"></div></li></ul></div></body></html>';
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:55,代码来源:WeixinAction.class.php

示例6: index

 public function index()
 {
     $this->isUserLogin();
     vendor('Weixinpay.WxPayPubHelper');
     //使用jsapi接口
     $jsApi = new \JsApi_pub();
     //=========步骤1:网页授权获取用户openid============
     //通过code获得openid
     $code = $_GET['code'];
     $jsApi->setCode($code);
     $openid = session('WST_USER')['wxId'];
     $pkey = session('WST_USER')["userId"] . "@" . $_SESSION["orderIds"];
     $time = time();
     $res = array('order_sn' => $time, 'order_amount' => $_SESSION['needPay']);
     //=========步骤2:使用统一支付接口,获取prepay_id============
     //使用统一支付接口
     $unifiedOrder = new \UnifiedOrder_pub();
     $total_fee = $res['order_amount'] * 100;
     //$total_fee = 1;
     $body = "订单支付{$res['order_sn']}";
     $unifiedOrder->setParameter("openid", "{$openid}");
     //用户标识
     $unifiedOrder->setParameter("body", $body);
     //商品描述
     //自定义订单号,此处仅作举例
     $out_trade_no = $res['order_sn'];
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商户订单号
     $unifiedOrder->setParameter("total_fee", $total_fee);
     //总金额
     $unifiedOrder->setParameter("attach", "{$pkey}");
     //附加数据
     $unifiedOrder->setParameter("notify_url", C('WxPayConf_pub.NOTIFY_URL'));
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     $unifiedOrder->SetParameter("input_charset", "UTF-8");
     //非必填参数,商户可根据实际情况选填
     $prepay_id = $unifiedOrder->getPrepayId();
     //=========步骤3:使用jsapi调起支付============
     $jsApi->setPrepayId($prepay_id);
     $jsApiParameters = $jsApi->getParameters();
     $wxconf = json_decode($jsApiParameters, true);
     if ($wxconf['package'] == 'prepay_id=') {
         $this->error('当前订单存在异常,不能使用支付');
     }
     $this->assign('res', $res);
     $this->assign('jsApiParameters', $jsApiParameters);
     $this->display('default/payment/wxjsapi/wxpay');
 }
开发者ID:wmk223,项目名称:demotp,代码行数:50,代码来源:WxJsPayAction.class.php

示例7: define

 function get_payform($order_info)
 {
     if (!defined('WXAPPID')) {
         $_SESSION['order_info'] = $order_info;
         define("WXAPPID", $this->_config['appid']);
         define("WXMCHID", $this->_config['mchid']);
         define("WXKEY", $this->_config['key']);
         define("WXAPPSECRET", $this->_config['appsecret']);
         define("WXCURL_TIMEOUT", 30);
         define('WXNOTIFY_URL', $this->_create_notify_url($order_info["order_id"], $order_info['payment_code']));
         define('WXJS_API_CALL_URL', $this->_create_notify_url($order_info["order_id"], $order_info['payment_code']));
         define('WXSSLCERT_PATH', ROOT_PATH . '/data/cacert/1/apiclient_cert.pem');
         define('WXSSLKEY_PATH', ROOT_PATH . '/data/cacert/1/apiclient_key.pem');
     }
     require_once dirname(__FILE__) . "/WxPayPubHelper/WxPayPubHelper.php";
     $unifiedOrder = new UnifiedOrder_pub();
     $jsApi = new JsApi_pub();
     if (!isset($_GET['code'])) {
         $baseUrl = urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']);
         //触发微信返回code码
         $urll = $jsApi->createOauthUrlForCode($baseUrl);
         //echo $url;
         Header("Location: {$urll}");
     } else {
         //获取code码,以获取openid
         $code = $_GET['code'];
         $jsApi->setCode($code);
         $openid = $jsApi->getOpenid();
     }
     $out_trade_no = $this->_get_trade_sn($order_info);
     $_SESSION['out_trade_on'] = $out_trade_no;
     $unifiedOrder->setParameter("body", $out_trade_no);
     //商品描述
     $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
     //商户订单号
     $unifiedOrder->setParameter("attach", $order_info['order_id']);
     //商户支付日志
     $unifiedOrder->setParameter("total_fee", strval(intval($order_info['order_amount'] * 100)));
     //总金额
     $unifiedOrder->setParameter("notify_url", WXNOTIFY_URL);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     $unifiedOrder->setParameter("openid", $openid);
     $jsApi->prepay_id = $unifiedOrder->getPrepayId();
     $unifiedOrderResult = $jsApi->getParameters();
     return $unifiedOrderResult;
 }
开发者ID:184609680,项目名称:wcy_O2O_95180,代码行数:48,代码来源:jspay.payment.php

示例8: fetchPrepayId

 /**
  * 通过统一支付接口 获得预付款ID
  */
 public function fetchPrepayId($wxOpenId, $body, $orderNo, $totalFee)
 {
     $unifiedOrder = new UnifiedOrder_pub($this);
     //设置统一支付接口参数
     $unifiedOrder->setParameter("openid", $wxOpenId);
     //微信用户openId
     $unifiedOrder->setParameter("body", $body);
     //商品描述
     $unifiedOrder->setParameter("out_trade_no", $orderNo);
     //商户订单号
     $unifiedOrder->setParameter("total_fee", $totalFee * 100);
     //总金额
     $unifiedOrder->setParameter("notify_url", $this->noticeUrl);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     $prepay_id = $unifiedOrder->getPrepayId();
     return $prepay_id;
 }
开发者ID:guohao214,项目名称:xinya,代码行数:22,代码来源:WeixinPayUtil.php

示例9: wxpayOp

    function wxpayOp()
    {
        $model = Model('mb_payment');
        $params = array('payment_code' => 'wxpay');
        $pay = $model->get_payment_info($params);
        $rt = unserialize($pay['payment_config']);
        $payconf = array('appid' => $rt['wxpay_appid'], 'appsecret' => $rt['wxpay_appsecret'], 'apikey' => $rt['wxpay_key'], 'mch_id' => $rt['wxpay_mch_id']);
        include_once BASE_PATH . DS . 'api' . DS . "wxpay/WxPayApi.php";
        //使用jsapi接口
        $jsApi = new JsApi_pub($payconf);
        //=========步骤1:网页授权获取用户openid============
        //通过code获得openid
        if (isset($_SESSION['wx_openid']) && $_SESSION['wx_openid']) {
            $openid = trim($_SESSION['wx_openid']);
        } else {
            if (!isset($_GET['code'])) {
                $redirect_uri = SHOP_SITE_URL . '/index.php?act=mb_payment&op=wxpay&pay_sn=' . $_GET['pay_sn'];
                //触发微信返回code码
                $url = $jsApi->createOauthUrlForCode(urlencode($redirect_uri));
                Header("Location: {$url}");
            } else {
                //获取code码,以获取openid
                $code = $_GET['code'];
                $jsApi->setCode($code);
                $openid = $jsApi->getOpenId();
                $_SESSION['wx_openid'] = $openid;
            }
        }
        $notify_url = 'http://' . $_SERVER['SERVER_NAME'] . '/wxnotify.php';
        //=========步骤2:使用统一支付接口,获取prepay_id============
        //使用统一支付接口
        $unifiedOrder = new UnifiedOrder_pub($payconf);
        //get order info
        $model = Model('mb_payment');
        $condition['pay_sn'] = $_GET['pay_sn'];
        $condition['order_state'] = ORDER_STATE_NEW;
        $order_list = $model->get_order_detail($condition);
        $total_amount = 0;
        $shipping_fee = 0;
        $order_amount = 0;
        $goods_desc = '';
        $order_sn = '';
        foreach ($order_list as $row) {
            $order_amount = $row['order_amount'];
            $shipping_fee = $row['shipping_fee'];
            $goods_desc .= $row['goods_name'];
            $order_sn = $row['order_sn'];
        }
        $goods_desc = $this->my_cus_substr($goods_desc, 20);
        $total_amount = (int) ($shipping_fee * 100 + $order_amount * 100);
        //设置统一支付接口参数
        //设置必填参数
        //appid已填,商户无需重复填写
        //mch_id已填,商户无需重复填写
        //noncestr已填,商户无需重复填写
        //spbill_create_ip已填,商户无需重复填写
        //sign已填,商户无需重复填写
        $unifiedOrder->setParameter("openid", "{$openid}");
        //商品描述
        $unifiedOrder->setParameter("body", "{$goods_desc}");
        //商品描述
        $unifiedOrder->setParameter("out_trade_no", "{$order_sn}");
        //商户订单号
        $unifiedOrder->setParameter("total_fee", "{$total_amount}");
        //总金额
        $unifiedOrder->setParameter("notify_url", $notify_url);
        //通知地址
        $unifiedOrder->setParameter("trade_type", "JSAPI");
        //交易类型
        //非必填参数,商户可根据实际情况选填
        //$unifiedOrder->setParameter("sub_mch_id","XXXX");//子商户号
        //$unifiedOrder->setParameter("device_info","XXXX");//设备号
        //$unifiedOrder->setParameter("attach","XXXX");//附加数据
        //$unifiedOrder->setParameter("time_start","XXXX");//交易起始时间
        //$unifiedOrder->setParameter("time_expire","XXXX");//交易结束时间
        //$unifiedOrder->setParameter("goods_tag","XXXX");//商品标记
        //$unifiedOrder->setParameter("openid","XXXX");//用户标识
        //$unifiedOrder->setParameter("product_id","XXXX");//商品ID
        $prepay_id = $unifiedOrder->getPrepayId();
        //=========步骤3:使用jsapi调起支付============
        $jsApi->setPrepayId($prepay_id);
        $jsApiParameters = $jsApi->getParameters();
        $redirect = SHOP_SITE_URL . '/index.php?act=wap_member_order';
        echo <<<EOF
\t\t\t<html>
\t\t\t\t<head>
\t\t\t\t    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
\t\t\t\t    <title>微信安全支付</title>
\t\t\t\t
\t\t\t\t\t<script type="text/javascript">
\t\t\t\t
\t\t\t\t\t\t//调用微信JS api 支付
\t\t\t\t\t\tfunction jsApiCall()
\t\t\t\t\t\t{
\t\t\t\t\t\t\tWeixinJSBridge.invoke(
\t\t\t\t\t\t\t\t'getBrandWCPayRequest',
\t\t\t\t\t\t\t\t{$jsApiParameters},
\t\t\t\t\t\t\t\tfunction(res){
\t\t\t\t\t\t\t\t\t//alert(res.err_msg);
\t\t\t\t\t\t\t\t\twindow.location.href = '{$redirect}';
//.........这里部分代码省略.........
开发者ID:wangjiang988,项目名称:ukshop,代码行数:101,代码来源:mb_payment.php

示例10: goToPay

    public function goToPay($payid, $openid, $fee, $out_trade_no, $tUrl, $eUrl, $proDesc)
    {
        if (!$payid || !$openid || !$fee || !$out_trade_no || !$tUrl || !$eUrl || !$proDesc) {
            showTips(U('Wap/Order/index'), "参数提交有误!");
        }
        //使用jsapi接口
        $fee = $fee * 100;
        $jsApi = new \JsApi_pub();
        $unifiedOrder = new \UnifiedOrder_pub();
        $unifiedOrder->setParameter("openid", "{$openid}");
        $unifiedOrder->setParameter("body", "{$proDesc}");
        //商品描述
        $unifiedOrder->setParameter("out_trade_no", "{$out_trade_no}");
        //商户订单号
        $unifiedOrder->setParameter("total_fee", "{$fee}");
        //总金额
        $unifiedOrder->setParameter("notify_url", WxPayConf_pub::NOTIFY_URL);
        //通知地址
        $unifiedOrder->setParameter("trade_type", "JSAPI");
        //交易类型
        $unifiedOrder->setParameter("attach", "{$payid}");
        //附加数据 订单ID
        $prepay_id = $unifiedOrder->getPrepayId();
        //=========步骤3:使用jsapi调起支付============
        $jsApi->setPrepayId($prepay_id);
        $jsApiParameters = $jsApi->getParameters();
        echo '
	        <html>
                <head>
                    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
                    <title>微信安全支付</title>

                    <script type="text/javascript">

                        //调用微信JS api 支付
                        function jsApiCall()
                        {
                            WeixinJSBridge.invoke(
                                "getBrandWCPayRequest",
                                ' . $jsApiParameters . ',
                                function(res){

                                    if(res.err_msg == "get_brand_wcpay_request:ok"){

                                        window.location.href = "' . $tUrl . '";
                                    }else{

                                        window.location.href = "' . $eUrl . '";
                                    }
                                }
                            );
                        }
                        function callpay()
                        {
                            if (typeof WeixinJSBridge == "undefined"){
                                if( document.addEventListener ){
                                    document.addEventListener("WeixinJSBridgeReady", jsApiCall, false);
                                }else if (document.attachEvent){
                                    document.attachEvent("WeixinJSBridgeReady", jsApiCall);
                                    document.attachEvent("WeixinJSBridgeReady", jsApiCall);
                                }
                            }else{
                                jsApiCall();
                            }
                        }
                        callpay();
                        </script>
                    </head>
              </html>
	        ';
    }
开发者ID:tearys,项目名称:lucky,代码行数:71,代码来源:js_api_call.php

示例11: header

 function wechat_pay()
 {
     header("Content-type: text/html; charset=utf-8");
     $order_sn = trim($_GET['order_sn']);
     $temp_order = $this->tickets->api_select('orders', 'to_order_amount,to_total_amount', array('to_order_sn' => $order_sn));
     $order = $temp_order[0];
     require_once APPPATH . 'libraries/wechat/WxPayPubHelper.php';
     //使用jsapi接口
     $wechat_config_temp = $this->tickets->select('payment', array('name' => 'wechat'));
     $weipay = $wechat_config_temp[0];
     $jsApi = new JsApi_pub($weipay->app_id, $weipay->payname, $weipay->partner_key, $weipay->app_secret);
     //=========步骤1:网页授权获取用户openid============
     //通过code获得openid
     if (!isset($_GET['code'])) {
         //触发微信返回code码
         $url = $jsApi->createOauthUrlForCode(urlencode(base_url() . 'index.php?c=wechat&m=wechat_pay&order_sn=' . $order_sn));
         Header("Location: {$url}");
         exit;
     }
     //获取code码,以获取openid
     $code = $_GET['code'];
     $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $weipay->app_id . "&secret=" . $weipay->app_secret . "&code=" . $code . "&grant_type=authorization_code";
     $result = $this->_curl_get_contents($url, 100);
     $result = json_decode($result);
     $openid = $result->openid;
     //=========步骤2:使用统一支付接口,获取prepay_id============
     //使用统一支付接口
     $unifiedOrder = new UnifiedOrder_pub($weipay->app_id, $weipay->payname, $weipay->partner_key, $weipay->app_secret);
     $unifiedOrder->setParameter("openid", $openid);
     //商品描述
     $unifiedOrder->setParameter("body", '小树好吃');
     //商品描述
     //自定义订单号,此处仅作举例
     $unifiedOrder->setParameter("out_trade_no", $order_sn);
     //商户订单号
     $unifiedOrder->setParameter("total_fee", 100 * $order->to_order_amount);
     //总金额$order->to_total_amount;
     $unifiedOrder->setParameter("notify_url", base_url() . '/wechat/wnotice');
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     //$unifiedOrder->setParameter("attach",'token='.$_GET['token'].'&wecha_id='.$_GET['wecha_id'].'&from='.$_GET['from']);//附加数据
     $prepay_id = $unifiedOrder->getPrepayId();
     //=========步骤3:使用jsapi调起支付============
     $jsApi->setPrepayId($prepay_id);
     $jsApiParameters = $jsApi->getParameters();
     $data['jsApiParameters'] = $jsApiParameters;
     $data['return_url'] = base_url() . 'wechat/member_center';
     $this->load->view('wechat/wechat_pay', $data);
 }
开发者ID:snamper,项目名称:CI_xiaoshuhaochi,代码行数:50,代码来源:wechat.php

示例12: test

 public function test($order_id = '')
 {
     vendor('WxPayPubHelper.WxPayPubHelper');
     //使用jsapi接口
     $jsApi = new \JsApi_pub();
     //=========步骤1:网页授权获取用户openid============
     //通过code获得openid
     if (!isset($_GET['code'])) {
         //触发微信返回code码
         $url = $jsApi->createOauthUrlForCode(\WxPayConf_pub::JS_API_CALL_URL . __SELF__);
         Header("Location: {$url}");
     } else {
         //获取code码,以获取openid
         $code = $_GET['code'];
         $jsApi->setCode($code);
         $openid = $jsApi->getOpenId();
     }
     $unifiedOrder = new \UnifiedOrder_pub();
     $order_info = M('FxOrder')->find($order_id);
     $order_info['product_name'] = '中华聚宝分销商城';
     $unifiedOrder->setParameter("openid", $openid);
     //商品描述
     $unifiedOrder->setParameter("body", '中华聚宝分销商城共消费¥' . $order_info['price']);
     //商品描述
     //自定义订单号,此处仅作举例
     $timeStamp = time();
     $out_trade_no = \WxPayConf_pub::APPID . $timeStamp;
     $unifiedOrder->setParameter("out_trade_no", $order_id . '_' . mt_rand(100, 999));
     //商户订单号
     if ($openid == 'olEDawig2ZbRO2v2zBNoyxXB32SE' || $openid == 'olEDawtGeisOHSSa539SCY68xqNc') {
         $unifiedOrder->setParameter("total_fee", $order_info['price']);
         //总金额
     } else {
         $unifiedOrder->setParameter("total_fee", $order_info['price'] * 100);
         //总金额
     }
     $unifiedOrder->setParameter("notify_url", \WxPayConf_pub::NOTIFY_URL_FX);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     //非必填参数,商户可根据实际情况选填
     // $unifiedOrder->setParameter("sub_mch_id","XXXX");//子商户号
     // $unifiedOrder->setParameter("device_info","XXXX");//设备号
     // $unifiedOrder->setParameter("attach","附加数据");//附加数据
     // $unifiedOrder->setParameter("time_start","交易起始时间");//交易起始时间
     // $unifiedOrder->setParameter("time_expire","交易结束时间");//交易结束时间
     // $unifiedOrder->setParameter("goods_tag","商品标记");//商品标记
     $unifiedOrder->setParameter("product_id", $order_id);
     //商品ID
     $prepay_id = $unifiedOrder->getPrepayId();
     // print_r($unifiedOrder);
     //=========步骤3:使用jsapi调起支付============
     $jsApi->setPrepayId($prepay_id);
     $jsApiParameters = $jsApi->getParameters();
     $this->assign('jsApiParameters', $jsApiParameters);
     $this->assign('order_id', $order_id);
     $this->display();
 }
开发者ID:wuwenbao,项目名称:paimai,代码行数:58,代码来源:WxJsApiController.class.php

示例13: get_payment_code

 public function get_payment_code($payment_notice_id)
 {
     $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
     $order_sn = $payment_notice['notice_sn'];
     $money = round($payment_notice['money'], 2);
     $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
     $payment_info['config'] = unserialize($payment_info['config']);
     $wx_config = $payment_info['config'];
     $sql = "select name " . "from " . DB_PREFIX . "deal " . "where id =" . intval($payment_notice['deal_id']);
     $title_name = $GLOBALS['db']->getOne($sql);
     if (!$payment_notice['order_id']) {
         $title_name = '充值';
     }
     $subject = $order_sn;
     include APP_ROOT_PATH . "system/payment/Wxjspay/WxPayPubHelper.php";
     // 		$data_notify_url = get_domain().APP_ROOT.'/wx_web/yjwap_response.php';
     //		$data_return_url = get_domain().APP_ROOT.'/wx_web/yjwap_notify.php';
     //
     //		$data_notify_url = str_replace("/sjmapi", "", $data_notify_url);
     //		$data_notify_url = str_replace("/mapi", "", $data_notify_url);
     //		$data_notify_url = str_replace("/wap", "", $data_notify_url);
     $data_return_url = str_replace("/sjmapi", "", $data_return_url);
     $data_return_url = str_replace("/mapi", "", $data_return_url);
     $data_return_url = str_replace("/wap", "", $data_return_url);
     $notify_url = get_domain() . REAL_APP_ROOT . "/wxpay_web/notify_url.php?order_id=" . intval($payment_notice['order_id']) . "&out_trade_no=" . $order_sn;
     //."&out_trade_no={$data.walipay.out_trade_no}";
     $order_id = $order_sn;
     //网页支付的订单在订单有效期内可以进行多次支付请求,但是需要注意的是每次请求的业务参数都要一致,交易时间也要保持一致。否则会报错“订单与已存在的订单信息不符”
     $return['notify_url'] = url_wap("cart#wx_jspay", array("id" => $payment_notice_id));
     $money_fen = intval($money * 100);
     if ($wx_config['type'] == 'V2') {
         require_once APP_ROOT_PATH . 'system/extend/ip.php';
         $iplocation = new iplocate();
         $user_ip = $iplocation->getIP();
         $unifiedOrder = new UnifiedOrder_pub();
         $unifiedOrder->update_config($wx_config['appid'], $wx_config['appsecret'], $wx_config['mchid'], $wx_config['partnerid'], $wx_config['partnerkey'], $wx_config['key'], $wx_config['sslcert'], $wx_config['sslkey']);
         $unifiedOrder->setParameter("input_charset", "GBK");
         $unifiedOrder->setParameter("bank_type", "WX");
         $unifiedOrder->setParameter("body", $title_name);
         $unifiedOrder->setParameter("partner", $wx_config['partnerid']);
         //$unifiedOrder->setParameter("out_trade_no", $unifiedOrder->create_noncestr());
         $unifiedOrder->setParameter("out_trade_no", $order_sn);
         $unifiedOrder->setParameter("total_fee", "{$money_fen}");
         $unifiedOrder->setParameter("fee_type", "0");
         $unifiedOrder->setParameter("notify_url", $notify_url);
         $unifiedOrder->setParameter("spbill_create_ip", $user_ip);
         $unifiedOrder->setParameter("input_charset", "GBK");
         $jsApiParameters = $unifiedOrder->create_biz_package();
     } elseif ($wx_config['type'] == 'V3' || $wx_config['type'] == 'V4') {
         $jsApi = new JsApi_pub();
         $jsApi->update_config($wx_config['appid'], $wx_config['appsecret'], $wx_config['mchid'], $wx_config['partnerid'], $wx_config['partnerkey'], $wx_config['key'], $wx_config['sslcert'], $wx_config['sslkey']);
         if (!isset($_GET['code'])) {
             //触发微信返回code码
             $url = $jsApi->createOauthUrlForCode(urlencode(get_domain() . $return['notify_url']));
             Header("Location: {$url}");
             $return['notify_url'] = $url;
             return $return;
         } else {
             //获取code码,以获取openid
             $code = $_GET['code'];
             $jsApi->setCode($code);
             $openid = $jsApi->getOpenId();
         }
         $unifiedOrder = new UnifiedOrder_pub();
         $unifiedOrder->update_config($wx_config['appid'], $wx_config['appsecret'], $wx_config['mchid'], $wx_config['partnerid'], $wx_config['partnerkey'], $wx_config['key'], $wx_config['sslcert'], $wx_config['sslkey']);
         $unifiedOrder->setParameter("openid", "{$openid}");
         //商品描述
         $unifiedOrder->setParameter("body", iconv_substr($title_name, 0, 50, 'UTF-8'));
         //商品描述
         $timeStamp = NOW_TIME;
         $unifiedOrder->setParameter("out_trade_no", "{$order_sn}");
         //商户订单号
         $unifiedOrder->setParameter("total_fee", $money_fen);
         //总金额
         $unifiedOrder->setParameter("notify_url", $notify_url);
         //通知地址
         $unifiedOrder->setParameter("trade_type", "JSAPI");
         //交易类型
         $prepay_id = $unifiedOrder->getPrepayId();
         //=========步骤3:使用jsapi调起支付============
         $jsApi->setPrepayId($prepay_id);
         $jsApiParameters = $jsApi->getParameters($wx_config['type']);
         if ($wx_config['type'] == 'V4') {
             $jsApiParameters = str_replace('deal_url', url_wap("deal#index", array('id' => $payment_notice['deal_id'])), $jsApiParameters);
         }
     }
     $return['parameters'] = $jsApiParameters;
     //echo $jsApiParameters;
     return $return;
 }
开发者ID:myjavawork,项目名称:sanxin-fangwei,代码行数:90,代码来源:Wwxjspay_payment.php

示例14: new_pay

	public function new_pay()
	{
		$orderid = $_GET['single_orderid'];
		$payHandel = new payHandle($this->token, $_GET['from'], 'weixin');
		$orderInfo = $payHandel->beforePay($orderid);
		$price = $orderInfo['price'];
		$this->assign('price', $price);

		if ($orderInfo['paid']) {
			$returnUrl = $this->siteUrl . '/index.php?g=Wap&m=' . $_GET['from'] . '&a=payReturn&nohandle=1&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&orderid=' . $orderid;
			$this->redirect($returnUrl);
			exit();
		}

		if ($this->_issystem) {
			$url = $this->code($orderid, $price);

			if (!is_string($url)) {
				$this->error($url['msg']);
			}

			$this->assign('url', urlencode($url));
		}
		else {
			import('@.ORG.Weixinnewpay.WxPayPubHelper');
			$jsApi = new JsApi_pub($this->payConfig['new_appid'], $this->payConfig['mchid'], $this->payConfig['key'], $this->payConfig['appsecret']);
			$unifiedOrder = new UnifiedOrder_pub($this->payConfig['new_appid'], $this->payConfig['mchid'], $this->payConfig['key'], $this->payConfig['appsecret']);
			$unifiedOrder->setParameter('openid', $this->wecha_id);
			$unifiedOrder->setParameter('body', $orderid);
			$unifiedOrder->setParameter('out_trade_no', $orderid);
			$unifiedOrder->setParameter('total_fee', $price * 100);

			if (strpos(CONF_PATH, 'DataPig')) {
				$noticeFileName = 'notice_datapig.php';
			}
			else if (strpos(CONF_PATH, 'PigData')) {
				$noticeFileName = 'notice_pigdata.php';
			}
			else {
				$noticeFileName = 'notice.php';
			}

			$unifiedOrder->setParameter('notify_url', $this->siteUrl . '/wxpay/' . $noticeFileName);
			$unifiedOrder->setParameter('trade_type', 'JSAPI');
			$unifiedOrder->setParameter('attach', 'token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&from=' . $_GET['from']);
			$prepay_id = $unifiedOrder->getPrepayId();

			if (empty($prepay_id)) {
				$this->error('没有获取到微信支付预支付ID,请管理员检查微信支付配置项!');
			}

			$jsApi->setPrepayId($prepay_id);
			$jsApiParameters = $jsApi->getParameters();
			$this->assign('jsApiParameters', $jsApiParameters);
		}

		$from = $_GET['from'];
		$from = ($from ? $from : 'Groupon');
		$from = ($from != 'groupon' ? $from : 'Groupon');
		$returnUrl = $this->siteUrl . '/index.php?g=Wap&m=' . $from . '&a=payReturn&nohandle=1&token=' . $_GET['token'] . '&wecha_id=' . $_GET['wecha_id'] . '&orderid=' . $orderid;
		$this->assign('returnUrl', $returnUrl);
		$message = '';
		$message .= '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-status-bar-style" content="black" /><meta name="format-detection" content="telephone=no" /><link href="/tpl/Wap/default/common/css/style/css/hotels.css" rel="stylesheet" type="text/css" /><title>微信支付</title>';

		if (empty($this->_issystem)) {
			$message .= '<script language="javascript">function callpay(){WeixinJSBridge.invoke("getBrandWCPayRequest",' . $jsApiParameters . ',function(res){WeixinJSBridge.log(res.err_msg);if(res.err_msg=="get_brand_wcpay_request:ok"){document.getElementById("payDom").style.display="none";document.getElementById("successDom").style.display="";setTimeout("window.location.href = \'' . $returnUrl . '\'",2000);}else{if(res.err_msg == "get_brand_wcpay_request:cancel"){var err_msg = "您取消了支付";}else if(res.err_msg == "get_brand_wcpay_request:fail"){var err_msg = "支付失败<br/>错误信息:"+res.err_desc;}else{var err_msg = res.err_msg +"<br/>"+res.err_desc;}document.getElementById("payDom").style.display = "none";document.getElementById("failDom").style.display = "";document.getElementById("failRt").innerHTML = err_msg;}});}</script>';
		}

		$message .= '</head><body style="padding-top:20px;"><style>.deploy_ctype_tip{z-index:1001;width:100%;text-align:center;position:fixed;top:50%;margin-top:-23px;left:0;}.deploy_ctype_tip p{display:inline-block;padding:13px 24px;border:solid #d6d482 1px;background:#f5f4c5;font-size:16px;color:#8f772f;line-height:18px;border-radius:3px;}</style><div id="payDom" class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付信息</span></li><li class="nob"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><th>金额</th><td>' . $price . '元</td></tr></table></li></ul>';

		if ($this->_issystem) {
			$message .= '<ul class="round" id="cross_pay"><li class="title mb" style="text-align:center"><span class="none">微信扫描支付</span></li><li class="nob" style="margin-bottom: 18px;"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><td style="text-align:center" ><img src="' . U('Weixin/qrcode', array('url' => $url)) . '" height="200" id="show_success"></td></tr><tr><td style="text-align:center">长按图片[识别二维码]付款</td></tr></table></li><li class="mb" style="text-align:center;margin-top: 20px;border-top: 1px solid #C6C6C6;" id="success"><span class="none"><a href="' . $returnUrl . '" style="color:#459ae9">我已经支付成功</a></span></li></ul>';
		}
		else {
			$message .= '<div class="footReturn" style="text-align:center" id="pay_div"><input type="button" style="margin:0 auto 20px auto;width:100%"  onclick="callpay()"  class="submit" value="点击进行微信支付" /></div>';
		}

		$message .= '</div><div id="failDom" style="display:none" class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付结果</span></li><li class="nob"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><th>支付失败</th><td><div id="failRt"></div></td></tr></table></li></ul><div class="footReturn" style="text-align:center"><input type="button" style="margin:0 auto 20px auto;width:100%"  onclick="callpay()"  class="submit" value="重新进行支付" /></div></div><div id="successDom" style="display:none" class="cardexplain"><ul class="round"><li class="title mb"><span class="none">支付成功</span></li><li class="nob"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang"><tr><td>您已支付成功,页面正在跳转...</td></tr></table><div id="failRt"></div></li></ul></div></body></html>';
		echo $message;
	}
开发者ID:kevicki,项目名称:pig,代码行数:80,代码来源:WeixinAction.class.php

示例15: time

 function get_code2($order, $payment)
 {
     //$uid = $_SESSION['user_name'];
     //$wxid = uidrwxid($uid);
     //var_dump($uid);
     //var_dump($wxid);
     //echo return_url('wxpay');
     //  @$openid=$_SESSION['sopenid'];
     //echo $_SESSION['sopenid']."dfdfds";exit;
     //echo $uid;exit;
     $openid = $_SESSION['xaphp_sopenid'];
     //测试
     if (empty($openid)) {
         return "";
     }
     //$openid = "oSxZVuNcC7qArMKsIgPeHeoHOydA";
     $unifiedOrder = new UnifiedOrder_pub();
     $conf = new WxPayConf_pub();
     if ($order['share_pay_type'] > 0) {
         $returnrul = "share_pay.php?act=success&id=" . $order["order_id"];
     } else {
         if ($order['extension_code'] == 'team_goods') {
             $returnrul = $conf->successurl . $order["order_id"] . "&team=1";
         } else {
             $returnrul = $conf->successurl . $order["order_id"];
         }
     }
     //var_dump($returnrul);
     //exit;
     $unifiedOrder->setParameter("openid", "{$openid}");
     //商品描述
     $unifiedOrder->setParameter("body", $order['order_sn']);
     //商品描述
     //自定义订单号,此处仅作举例
     $timeStamp = time();
     //$out_trade_no = WxPayConf_pub::APPID."$timeStamp";
     $unifiedOrder->setParameter("out_trade_no", $order['order_sn']);
     //商户订单号
     $unifiedOrder->setParameter("total_fee", intval($order['order_amount'] * 100));
     //总金额
     $unifiedOrder->setParameter("notify_url", $conf->notifyurl);
     //通知地址
     $unifiedOrder->setParameter("trade_type", "JSAPI");
     //交易类型
     $unifiedOrder->setParameter("is_subscribe", "Y");
     //交易类型
     // $unifiedOrder->setParameter("body","商品");
     //    if(!empty($order['goods_name'])){
     //	    $unifiedOrder->setParameter("body",  mb_strlen($order['goods_name'],"utf-8")>20 ? mb_substr($order['goods_name'],0,20,'utf-8') : $order['goods_name'] );
     //	}
     //非必填参数,商户可根据实际情况选填
     //$unifiedOrder->setParameter("sub_mch_id","XXXX");//子商户号
     //$unifiedOrder->setParameter("device_info","XXXX");//设备号
     //$unifiedOrder->setParameter("attach","XXXX");//附加数据
     //$unifiedOrder->setParameter("time_start","XXXX");//交易起始时间
     //$unifiedOrder->setParameter("time_expire","XXXX");//交易结束时间
     //$unifiedOrder->setParameter("goods_tag","XXXX");//商品标记
     //$unifiedOrder->setParameter("openid","XXXX");//用户标识
     //$unifiedOrder->setParameter("product_id","XXXX");//商品ID
     $prepay_id = $unifiedOrder->getPrepayId();
     $jsApi = new JsApi_pub();
     $jsApi->setPrepayId($prepay_id);
     $jsApiParameters = $jsApi->getParameters();
     return array('jsApiParameters' => json_decode($jsApiParameters, true), 'returnrul' => $returnrul);
     //return $pay_online;
 }
开发者ID:shiruolin,项目名称:hzzshop,代码行数:66,代码来源:wxpay.php


注:本文中的UnifiedOrder_pub::getPrepayId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。