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


PHP WxPayUnifiedOrder::SetOpenid方法代码示例

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


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

示例1: JsApiPay

 /**
  * jsapi支付
  * @param string  $user_id    用户id
  * @param int     $order_id
  * @param string  $order_sn   订单号
  * @param int     $total_fee  费用
  * @param string  $body       商品或支付单简要描述
  * @param string  $goods_tag  商品标记
  * @param string  $attach     自定义数据
  * @return array
  */
 public function JsApiPay($user_id, $order_id, $order_sn, $total_fee, $body = '', $goods_tag = '', $attach = '')
 {
     if (empty($user_id) || empty($total_fee)) {
         return ['status' => -1, 'message' => '数据错误'];
     }
     $tools = new JsApiPay();
     $openId = UserModel::instance()->getOpenId($user_id);
     if (empty($openId)) {
         $openId = $tools->GetOpenid();
         //             return ['status'=> -2 , 'message'=>'user_id错误'];
     }
     $input = new \WxPayUnifiedOrder();
     $input->SetBody($body);
     $input->SetAttach($attach);
     $input->SetOut_trade_no($order_sn);
     //\WxPayConfig::MCHID.date("YmdHis")
     $input->SetTotal_fee($total_fee);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetGoods_tag($goods_tag);
     $input->SetTrade_type("JSAPI");
     $input->SetOpenid($openId);
     $order = \WxPayApi::unifiedOrder($input);
     if ($order['return_code'] != 'SUCCESS') {
         return ['status' => -10, 'message' => $order['return_msg']];
     }
     $jsApiParameters = $tools->GetJsApiParameters($order);
     $this->addPayLog($openId, $order_id, $input);
     return ['status' => 1, 'message' => $jsApiParameters];
 }
开发者ID:xswolf,项目名称:dc,代码行数:41,代码来源:PayEvent.class.php

示例2: jsapipay

/**
 * 生成支付接口内容
 * @param $data
 * @param bool $debug
 * @return json
 */
function jsapipay($data, $debug = false)
{
    // C('weixin.weixin_')
    //①、获取用户openid
    $tools = new JsApiPay();
    //    $openId = $tools->GetOpenid();
    if (!empty($data['openid'])) {
        $openId = $data['openid'];
    } else {
        echo "empty openid";
        die;
    }
    //②、统一下单
    $input = new WxPayUnifiedOrder();
    $input->SetBody($data['body']);
    $input->SetAttach($data['attach']);
    $input->SetOut_trade_no($data['order_sn']);
    $input->SetTotal_fee($data['total_fee']);
    $input->SetTime_start(date("YmdHis"));
    $input->SetTime_expire(date("YmdHis", time() + 600));
    $input->SetGoods_tag($data['goods_tag']);
    $input->SetNotify_url("http://{$_SERVER[HTTP_HOST]}/weixin/notify.html");
    $input->SetTrade_type("JSAPI");
    $input->SetOpenid($openId);
    $order = WxPayApi::unifiedOrder($input);
    if ($debug) {
        echo '<font color="#f00"><b>统一下单支付单信息</b></font><br/>';
        printf_info($order);
    }
    $jsApiParameters = $tools->GetJsApiParameters($order);
    return $jsApiParameters;
}
开发者ID:ysc8620,项目名称:zhima,代码行数:38,代码来源:weizhao.php

示例3: wxJsPay

 public function wxJsPay()
 {
     $list = isset($_SESSION['orderinfo']) ? $_SESSION['orderinfo'] : array();
     if (!isset($_SESSION['orderinfo'])) {
         header("Location:" . appurl('getMeOrder'));
         die;
     }
     //验证是否能预定
     if (isset($_SESSION['orderList'])) {
         foreach ($_SESSION['orderList'] as $key => $value) {
             $this->checkCanSum($value['bookid'], $value);
             if (!$this->checkBook($value['bookid'])) {
                 $this->alert($value['title'] . '已经售卖结束');
                 exit;
             }
         }
     }
     //初始化日志
     $logHandler = new CLogFileHandler("../logs/" . date('Y-m-d') . '.log');
     $log = Log::Init($logHandler, 15);
     //①、获取用户openid
     $tools = new JsApiPay();
     $openId = $tools->GetOpenid();
     //②、统一下单
     //价钱转成分
     $totalFee = $list['allPrice'] * 100;
     $input = new WxPayUnifiedOrder();
     $input->SetBody("订单");
     $input->SetAttach("订单");
     $input->SetOut_trade_no($list['orderid']);
     $input->SetTotal_fee($totalFee);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetGoods_tag("订单");
     $input->SetNotify_url(appurl('callBack'));
     // "http://paysdk.weixin.qq.com/example/notify.php"
     $input->SetTrade_type("JSAPI");
     $input->SetOpenid($openId);
     $order = WxPayApi::unifiedOrder($input);
     echo '<font color="#f00"><b>支付中,客官请稍后....</b></font><br/>';
     // $this->printf_info($order);
     $jsApiParameters = $tools->GetJsApiParameters($order);
     //获取共享收货地址js函数参数
     $editAddress = $tools->GetEditAddressParameters();
     //③、在支持成功回调通知中处理成功之后的事宜,见 notify.php
     /**
      * 注意:
      * 1、当你的回调地址不可访问的时候,回调通知会失败,可以通过查询订单来确认支付是否成功
      * 2、jsapi支付时需要填入用户openid,WxPay.JsApiPay.php中有获取openid流程 (文档可以参考微信公众平台“网页授权接口”,
      * 参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html)
      */
     $data = array('jsApiParameters' => $jsApiParameters, 'editAddress' => $editAddress, 'orderid' => $list['orderid'], 'pageTitle' => '支付');
     unset($_SESSION['orderinfo']);
     $this->layoutRender('/wxpay', $data);
 }
开发者ID:aising,项目名称:ding,代码行数:55,代码来源:PayController.php

示例4: getJsApiParameters

 public function getJsApiParameters($out_trade_no = '', $fee = '', $openId = '')
 {
     $input = new WxPayUnifiedOrder();
     $input->SetBody("购买相册打印服务");
     $input->SetOut_trade_no($out_trade_no);
     $input->SetTotal_fee($fee);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetNotify_url('http://api.dayinxiangsh.com/1.0/pay/callback');
     $input->SetTrade_type("JSAPI");
     $input->SetOpenid($openId);
     $order = WxPayApi::unifiedOrder($input);
     $jsApiParameters = $this->getParameters($order);
     return $jsApiParameters;
 }
开发者ID:mingshi,项目名称:printer-api,代码行数:15,代码来源:Wxpay.php

示例5: createUnifiedOrder

 public function createUnifiedOrder($out_trade_no, $subject, $total_fee, $open_id = null)
 {
     //②、统一下单
     $input = new \WxPayUnifiedOrder();
     $input->setWxPayApi($this->wxPayApi);
     $input->SetBody($subject);
     $input->SetOut_trade_no($out_trade_no);
     //        $input->SetTotal_fee($total_fee);
     $input->SetTotal_fee(intval($total_fee * 100));
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetTrade_type($this->trade_type);
     if ($open_id) {
         $input->SetOpenid($open_id);
     }
     $order = $this->wxPayApi->unifiedOrder($input);
     return $order;
 }
开发者ID:fishlab,项目名称:wechat-sdk-php,代码行数:18,代码来源:WechatPaymentSupport.php

示例6: unifiedorder

 public function unifiedorder($openId, $product_id)
 {
     //统一下单
     $input = new WxPayUnifiedOrder();
     $input->SetBody("test");
     $input->SetAttach("test");
     $input->SetOut_trade_no(WxPayConfig::MCHID . date("YmdHis"));
     $input->SetTotal_fee("1");
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetGoods_tag("test");
     $input->SetNotify_url("http://paysdk.weixin.qq.com/example/notify.php");
     $input->SetTrade_type("NATIVE");
     $input->SetOpenid($openId);
     $input->SetProduct_id($product_id);
     $result = WxPayApi::unifiedOrder($input);
     Log::DEBUG("unifiedorder:" . json_encode($result));
     return $result;
 }
开发者ID:aising,项目名称:ding,代码行数:19,代码来源:native_notify.php

示例7: unifiedorder

 public function unifiedorder($openId, $product_id)
 {
     //统一下单
     $input = new WxPayUnifiedOrder();
     $input->SetBody("test");
     $input->SetAttach("test");
     $input->SetOut_trade_no(WxPayConfig::MCHID . date("YmdHis"));
     $input->SetTotal_fee("1");
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetGoods_tag("test");
     $input->SetNotify_url(Config::API_NOTIFY_URL);
     $input->SetTrade_type("NATIVE");
     $input->SetOpenid($openId);
     $input->SetProduct_id($product_id);
     $result = WxPayApi::unifiedOrder($input, Config::API_TIMEOUT);
     Log::DEBUG("unifiedorder:" . json_encode($result));
     return $result;
 }
开发者ID:xiaoziwuzui,项目名称:gdby_github_repo,代码行数:19,代码来源:native_notify.php

示例8: getUnifiedOrder

 /**
  * 统一下单
  *
  * @param $amount
  *
  * @return string
  */
 private function getUnifiedOrder($amount)
 {
     $tools = new \JsApiPay();
     $openId = $tools->GetOpenid();
     //获取用户openID
     $outTradeNo = \tools\Tools::uuid();
     $input = new \WxPayUnifiedOrder();
     $input->SetBody($this->data['memo']);
     $input->SetAttach($this->data['id']);
     $input->SetOut_trade_no($outTradeNo);
     $input->SetTotal_fee($this->amount);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetGoods_tag($this->data['memo']);
     $input->SetNotify_url($this->notify_url);
     $input->SetTrade_type("JSAPI");
     $input->SetOpenid($openId);
     $order = \WxPayApi::unifiedOrder($input);
     $jsApiParameters = $tools->GetJsApiParameters($order);
     //获取共享收货地址js函数参数
     $editAddress = $tools->GetEditAddressParameters();
     return ['jsApiParameters' => $jsApiParameters, 'editAddress' => $editAddress, 'amount' => $amount, 'orderId' => $this->data['id']];
 }
开发者ID:hejxing,项目名称:jt,代码行数:30,代码来源:Api.php

示例9: jsApiParametersGet_action

 /**
  *
  */
 public function jsApiParametersGet_action($mpid, $order)
 {
     $user = $this->getUser($mpid);
     $order = $this->model('app\\merchant\\order')->byId($order);
     if (false === $order) {
         return new \ResponseError('订单不存在');
     }
     $products = array();
     $order->products = json_decode($order->products);
     foreach ($order->products as $prod) {
         $products[] = $prod->name;
     }
     $products = implode(',', $products);
     $notifyUrl = "http://" . $_SERVER['HTTP_HOST'];
     $notifyUrl .= "/rest/op/merchant/payok/notify";
     $tools = $this->model('mpproxy/WxPayJsApi');
     $wxPayConfig = new \WxPayConfig($mpid);
     $input = new \WxPayUnifiedOrder();
     $input->SetBody($products);
     $input->SetAttach("测试附加信息");
     $input->SetOut_trade_no($order->trade_no);
     $input->SetTotal_fee($order->order_total_price);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetGoods_tag("测试标签");
     $input->SetNotify_url($notifyUrl);
     $input->SetTrade_type("JSAPI");
     $input->SetOpenid($user->openid);
     $order = \WxPayApi::unifiedOrder($mpid, $input);
     if ($order['result_code'] === 'FAIL') {
         return new \ResponseError($order['err_code_des']);
     }
     $jsApiParameters = $tools->GetJsApiParameters($mpid, $order);
     //获取共享收货地址js函数参数
     $editAddress = $tools->GetEditAddressParameters($mpid);
     $rsp = array('jsApiParameters' => $jsApiParameters, 'editAddress' => $editAddress);
     return new \ResponseData($rsp);
 }
开发者ID:ahmatjan,项目名称:xinxintong,代码行数:41,代码来源:pay.php

示例10: create_order

 protected function create_order($user_id, $trade_type, $attach, $fee, $open_id = null)
 {
     // 商户号 + 用户id + uniqid生成的随机字符串
     $out_trade_no = WxPayConfig::MCHID . uniqid($user_id);
     // 需重置下当前时区,PHP配置文件不知为何不起作用
     //date_default_timezone_set('PRC');
     // 统一下单
     $input = new WxPayUnifiedOrder();
     $input->SetBody("挂号费");
     $input->SetAttach($attach);
     $input->SetOut_trade_no($out_trade_no);
     // 测试用1分钱
     $input->SetTotal_fee(1);
     $current_time = time();
     $start = date('YmdHis', $current_time);
     $expire = date('YmdHis', $current_time + 3600);
     // 下单时间:当前时间
     $input->SetTime_start($start);
     // 失效时间:测试用一个小时
     $input->SetTime_expire($expire);
     $input->SetGoods_tag("挂号费");
     $input->SetNotify_url("http://test.zerioi.com/pay/wxpay_notify");
     $input->SetTrade_type($trade_type);
     // JSAPI调用支付需设置open_id
     if ($open_id) {
         $input->SetOpenid($open_id);
     }
     $record = new WeixinPay();
     $record->trade_no = $out_trade_no;
     $record->trade_type = $trade_type;
     $record->time_start = $start;
     $record->time_expire = $expire;
     $record->user_id = $user_id;
     $record->open_id = $open_id;
     $record->attach = $attach;
     $record->total_fee = $fee;
     $record->status = 'UNFINISHED';
     if (!$record->save()) {
         throw new Exception("Could not save pay parameters");
     }
     return WxPayApi::unifiedOrder($input);
 }
开发者ID:Jv-Juven,项目名称:hospital-register-system,代码行数:42,代码来源:PayController.php

示例11: jsApiPay

 /**
  *
  * jsApi微信支付示例
  * 注意:
  * 1、微信支付授权目录配置如下  http://www.youweihui.net/addon/Wxpay/Index/jsApiPay/mp_id/
  * 2、支付页面地址需带mp_id参数
  * 3、管理后台-基础设置-公众号管理,微信支付必须配置的参数都需填写正确
  * @param array $mp_id 公众号在系统中的ID
  * @return 将微信支付需要的参数写入支付页面,显示支付页面
  */
 public function jsApiPay()
 {
     $uid = get_ucuser_uid();
     //获取粉丝用户uid,一个神奇的函数,没初始化过就初始化一个粉丝
     if ($uid === false) {
         $this->error('只可在微信中访问');
     }
     $user = get_uid_ucuser($uid);
     //获取本地存储公众号粉丝用户信息
     $this->assign('user', $user);
     $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $surl = get_shareurl();
     if (!empty($surl)) {
         $this->assign('share_url', $surl);
     }
     //odata通用订单数据,订单数据可以从订单页面提交过来
     $odata['uid'] = $uid;
     $odata['mp_id'] = $params['mp_id'];
     // 当前公众号在系统中ID
     $odata['order_id'] = "time" . date("YmdHis");
     //
     $odata['order_status'] = 1;
     //不带该字段-全部状态, 2-待发货, 3-已发货, 5-已完成, 8-维权中
     $odata['order_total_price'] = 1;
     //订单总价,单位:分
     $odata['buyer_openid'] = $user['openid'];
     $odata['buyer_nick'] = $user['nickname'];
     $odata['receiver_mobile'] = $user['mobile'];
     $odata['product_id'] = 1;
     $odata['product_name'] = "UCToo";
     $odata['product_price'] = 100;
     //商品价格,单位:分
     $odata['product_sku'] = "UCToo_Wxpay";
     $odata['product_count'] = 1;
     $odata['module'] = MODULE_NAME;
     $odata['model'] = "order";
     $odata['aim_id'] = 1;
     $order = D("Order");
     // 实例化order对象
     $order->create($odata);
     // 生成数据对象
     $result = $order->add();
     // 写入数据
     if ($result) {
         // 如果主键是自动增长型 成功后返回值就是最新插入的值
     }
     //获取公众号信息,jsApiPay初始化参数
     $info = get_mpid_appinfo($odata['mp_id']);
     $this->options['appid'] = $info['appid'];
     $this->options['mchid'] = $info['mchid'];
     $this->options['mchkey'] = $info['mchkey'];
     $this->options['secret'] = $info['secret'];
     $this->options['notify_url'] = $info['notify_url'];
     $this->wxpaycfg = new WxPayConfig($this->options);
     //①、初始化JsApiPay
     $tools = new JsApiPay($this->wxpaycfg);
     $wxpayapi = new WxPayApi($this->wxpaycfg);
     //②、统一下单
     $input = new WxPayUnifiedOrder($this->wxpaycfg);
     //这里带参数初始化了WxPayDataBase
     //  $input->SetAppid($info['appid']);//公众账号ID
     //  $input->SetMch_id($info['mchid']);//商户号
     $input->SetBody($odata['product_name']);
     $input->SetAttach($odata['product_sku']);
     $input->SetOut_trade_no($odata['order_id']);
     $input->SetTotal_fee($odata['order_total_price']);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     // $input->SetGoods_tag("WXG");                      //商品标记,代金券或立减优惠功能的参数
     //  $input->SetNotify_url($info['notify_url']);       //http://test.uctoo.com/index.php/UShop/Index/notify
     $input->SetTrade_type("JSAPI");
     $input->SetOpenid($user['openid']);
     $order = $wxpayapi->unifiedOrder($input);
     $jsApiParameters = $tools->GetJsApiParameters($order);
     //获取共享收货地址js函数参数
     $editAddress = $tools->GetEditAddressParameters();
     //③、在支持成功回调通知中处理成功之后的事宜,见 notify.php
     /**
      * 注意:
      * 1、当你的回调地址不可访问的时候,回调通知会失败,可以通过查询订单来确认支付是否成功
      * 2、jsapi支付时需要填入用户openid,WxPay.JsApiPay.php中有获取openid流程 (文档可以参考微信公众平台“网页授权接口”,
      * 参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html)
      */
     $this->assign('order', $odata);
     $this->assign('jsApiParameters', $jsApiParameters);
     $this->assign('editAddress', $editAddress);
     $this->display();
 }
开发者ID:bjjfsd,项目名称:youweihui,代码行数:98,代码来源:IndexController.class.php

示例12: getUnifiedOrder

 /**
  *
  * 生成预支付订单
  * @param data
  *  + body
  *  + out_trade_no
  *  + total_fee
  *  + product_id
  *  + time_expire
  *  + attach
  *  + openid
  */
 public static function getUnifiedOrder($data)
 {
     $input = new WxPayUnifiedOrder();
     // 商品描述
     $body = '商品付款';
     if ($data['body']) {
         $body = $data['body'];
     }
     $input->SetBody($body);
     // 商户订单号
     $input->SetOut_trade_no($data['out_trade_no']);
     // 订单交易总额
     $input->SetTotal_fee($data['total_fee']);
     // 商品ID
     if ($data['product_id']) {
         $input->SetProduct_id($data['product_id']);
     }
     $input->SetTime_start(date("YmdHis", $data['time_start']));
     // 订单过期时间,微信最长过期时间可设置为 2 小时,最短为5分钟
     $input->SetTime_expire(date("YmdHis", strtotime($data['time_start']) + 7200));
     // 订单通知回调的 url
     $input->SetNotify_url(WxPayConfig::$notify_url);
     // 支付类型:扫码支付
     $input->SetTrade_type($data['trade_type']);
     // 选填参数设置
     if ($data['attach']) {
         $input->SetAttach($data['attach']);
     }
     // 扫码支付模式一,第一次微信回调会带有用户的 openid,请求生成预支付 id 时需要加入到请求参数内
     if ($data['openid']) {
         $input->SetOpenid($data['openid']);
     }
     return $input;
 }
开发者ID:jiaoyix,项目名称:jiaoyix-php,代码行数:46,代码来源:WxPay.php

示例13: wxJsPay

  private function wxJsPay($request)
  {
    $state = $request->input('state');

    $decodeObject = json_decode($state);

    $user = Auth::user();

    $order_code = $decodeObject->order_code;

    $order = Order::where('code', '=', $order_code)->first();

    if (empty($order->id)) {
    
      //todo
    
    } else if ($order->status > 0) {
    
      return view('mobile/payed');
    
    }

    $good = Good::where('id', '=', $order->gid)->first();

    $orderPrice = OrderPrice::where('oid', '=', $order->id)->first();

    $receiver = ReceiverInfo::find($order->rid);

    require_once "lib/WxPay.Api.php";  

    require_once "lib/WxPay.JsApiPay.php";

    $notify_url = $this->debug ? "http://www.51linpai.com:8000/order/wxpay/" : "http://www.51linpai.com/order/wxpay/";

    $tools = new \JsApiPay();

    $openId = $tools->GetOpenid("", null);

    $input = new \WxPayUnifiedOrder();
    $input->SetBody($good->name);
    $input->SetAttach($good->code);
    $input->SetOut_trade_no($order->code);
    $input->SetTotal_fee($orderPrice->final_price * 100);
    $input->SetTime_start(date("YmdHis"));
    $input->SetTime_expire(date("YmdHis", time() + 600));
    $input->SetGoods_tag($good->code);
    $input->SetNotify_url($notify_url);
    $input->SetTrade_type("JSAPI");
    $input->SetOpenid($openId);
    $jsWxOrder = \WxPayApi::unifiedOrder($input);
    $jsApiParameters = $tools->GetJsApiParameters($jsWxOrder);

    //获取共享收货地址js函数参数
    $editAddress = $tools->GetEditAddressParameters();

    $data = [

        'editAddress' => $editAddress,

        'jsApiParameters' => $jsApiParameters,

        'order_code' => $order->code,

        'price' => $orderPrice->final_price,

        'address' =>  $receiver->city . ' ' . $receiver->district . ' ' . $receiver->address,

        'step' => 4,

        'header' => '支付订单'
      
      ];
    
    return view('mobile/wechat_js_pay', $data);
  
  }
开发者ID:kukujiabo,项目名称:linpai,代码行数:76,代码来源:OrdersController.php

示例14: weiXinPay

 /**
  * 微信支付
  * @param $orderId
  * @return array
  * @throws \WxPayException
  */
 public function weiXinPay($orderId)
 {
     //①、获取用户openid
     $tools = new \JsApiPay();
     $openId = $tools->GetOpenid();
     if ($openId == -1) {
         return false;
     }
     //②、统一下单
     $orderInfo = ChargeOrder::getInstance()->getOne($orderId);
     $goods = ChargeGoods::getInstance()->getOne($orderInfo['charge_goods_id']);
     $input = new \WxPayUnifiedOrder();
     $input->SetBody("嘉瑞百合缘-【" . $goods['name'] . "】");
     $input->SetAttach("手机网站");
     $input->SetOut_trade_no($orderInfo['order_id']);
     $input->SetTotal_fee((string) $orderInfo['money']);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetNotify_url("http://wechat.baihey.com/wap/charge/notify-url");
     $input->SetTrade_type("JSAPI");
     $input->SetOpenid($openId);
     $order = \WxPayApi::unifiedOrder($input);
     $jsApiParameters = $tools->GetJsApiParameters($order);
     return ['orderInfo' => $orderInfo, 'jsApiParameters' => $jsApiParameters];
 }
开发者ID:xswolf,项目名称:baihey,代码行数:31,代码来源:ChargeOrder.php

示例15: pay

 public function pay()
 {
     require_once 'Weixinpay/WxPayData.class.php';
     require_once 'Weixinpay/WxPayApi.class.php';
     require_once 'Weixinpay/WxPayJsApiPay.php';
     // require_once ('Weixinpay/log.php');
     $paymentId = $_GET['paymentId'];
     $token = $_GET['token'];
     $body = $_GET['orderName'];
     $orderNo = $_GET['orderNumber'];
     if ($orderNo == "") {
         $orderNo = $_GET['single_orderid'];
     }
     $totalFee = $_GET['price'] * 100;
     // 单位为分
     // $paytype=$_GET['paytype'];
     $tools = new \JsApiPay();
     // $openId = $tools->GetOpenid();
     // $openId=$_GET['wecha_id'];
     // $openId=get_openid();
     // dump($openId);
     // die();
     // // dump($openId);
     //         $openId='orgF0t-HyMrDJHFOl9GAkENyu6i0';
     // dump('45456');
     $openId = $this->getPaymentOpenid();
     //         dump(session('paymentinfo'));
     //         dump($openId);
     //         dump('1232');die;
     // 统一下单
     import('Weixinpay.WxPayData');
     $input = new \WxPayUnifiedOrder();
     $input->SetBody($body);
     // $input->SetAttach("test");
     $input->SetOut_trade_no($orderNo);
     $input->SetTotal_fee($totalFee);
     // $input->SetTime_start(date("YmdHis"));
     // $input->SetTime_expire(date("YmdHis", time() + 600));
     // $input->SetGoods_tag("test");
     $input->SetNotify_url("Weixinpay/notify.php");
     $input->SetTrade_type("JSAPI");
     $input->SetOpenid($openId);
     $order = \WxPayApi::unifiedOrder($input);
     //         echo '<font color="#f00"><b>统一下单支付单信息</b></font><br/>';
     //dump($order);
     //         die;
     $jsApiParameters = $tools->GetJsApiParameters($order);
     //  dump($jsApiParameters);
     $returnUrl = addons_url('Payment://Weixin/payOK');
     header('Location:' . SITE_URL . '/WxpayAPI/unifiedorder.php?jsApiParameters=' . $jsApiParameters . '&returnurl=' . $returnUrl . '&totalfee=' . $_GET['price'] . '&paymentId=' . $paymentId);
     // echo $jsApiParameters;
     // die;
     // session('jsaparams',$jsApiParameters);
     // $_COOKIE['jsaparams']=$jsApiParameters;
     // $from=$_GET['from'];
     // if($from!='shop'){
     // $from=$this->doFromStr($_GET['from']);
     // }
     // //$returnUrl = '/index.php?g=Wap&m=' . $from . '&a=payReturn&token=' . $_GET ['token'] . '&wecha_id=' . $_GET ['wecha_id'] . '&orderid=' . $orderNo;
     // $returnUrl=addons_url('Payment://Weixin/payOK');
     // //$this->assign ( 'returnUrl', $returnUrl );
     // $this->assign ( 'jsApiParameters', $jsApiParameters );
     // $this->assign ( 'price', $_GET['price'] );
     // die;
     // header('Location:http://'.$_SERVER['HTTP_HOST'].'/weishi/WxpayAPI/unifiedorder.php?body='.$body.'&out_trade_no='.$orderNo.'&totalfee='.$totalFee.'&openid='.$openId.'&returnurl='.$returnUrl);
 }
开发者ID:chenpusn,项目名称:guoxian,代码行数:66,代码来源:WeixinController.class.php


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