• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WxPayUnifiedOrder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: unifiedOrder

 /** 统一下单 */
 public function unifiedOrder()
 {
     $input = new \WxPayUnifiedOrder();
     $input->SetBody("云豆充值");
     $input->SetAttach("云豆充值");
     $input->SetOut_trade_no(\WxPayConfig::MCHID . date("YmdHis"));
     //totalFee是以分为单位的,正式情况下应该乘以100
     $totalFee = $this->money * 100;
     $input->SetTotal_fee($totalFee);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     //$input->SetGoods_tag("test");
     $input->SetNotify_url(Url::base(true) . '/notify.php');
     //$input->SetNotify_url(Url::to(['/we-chat/notify'],true));
     return $input;
 }
开发者ID:krissss,项目名称:YunDou-advanced,代码行数:17,代码来源:RechargeForm.php


示例4: addPayLog

 /**
  * 记录支付日志
  */
 private function addPayLog($openid, $order_id, \WxPayUnifiedOrder $input)
 {
     $data = ['openid' => $openid, 'order_id' => intval($order_id), 'order_sn' => $input->GetOut_trade_no(), 'body' => $input->GetBody(), 'total_fee' => $input->GetTotal_fee(), 'attach' => $input->GetAttach(), 'time_start' => strtotime($input->GetTime_start()), 'time_expire' => strtotime($input->GetTime_expire()), 'pay_time' => 0, 'status' => 0, 'wx_pay_sn' => '', 'is_send' => 0, 'created_at' => time()];
     $M = M("wx_pay_log");
     $rel = $M->where(["openid" => $openid, 'order_sn' => $data['order_sn']])->select();
     if (empty($rel)) {
         $M->add($data);
     } else {
         $M->where(["openid" => $openid, 'order_sn' => $data['order_sn']])->save($data);
     }
 }
开发者ID:xswolf,项目名称:dc,代码行数:14,代码来源:PayEvent.class.php


示例5: preOrder

 public function preOrder($param)
 {
     $order = new WxPayUnifiedOrder();
     $order->SetOut_trade_no($param['out_trade_no']);
     $order->SetTotal_fee($param['total_fee'] * 100);
     $order->SetTrade_type('APP');
     $order->SetBody($param['body']);
     $order->SetDetail($param['detail']);
     $order->SetNotify_url($this->_notify_url);
     $re = WxPayApi::unifiedOrder($order);
     if ($re['result_code'] == 'FAIL') {
         throw new Exception("微信 preorder 错误-" . $re['err_code_des'], 9001);
     }
     if ($re['return_code'] == 'FAIL') {
         throw new Exception("微信 preorder 错误-" . $re['return_msg'], 9001);
     }
     return $re;
 }
开发者ID:qnck,项目名称:qingnianchuangke,代码行数:18,代码来源:WechatPay.php


示例6: unifiedOrder

 /**
  * 
  * 统一下单,WxPayUnifiedOrder中out_trade_no、body、total_fee、trade_type必填
  * appid、mchid、spbill_create_ip、nonce_str不需要填入
  * @param WxPayUnifiedOrder $inputObj
  * @param int $timeOut
  * @throws WxPayException
  * @return 成功时返回,其他抛异常
  */
 public static function unifiedOrder($inputObj, $timeOut = 6)
 {
     $url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
     $inputObj->SetAppid(APPID);
     //公众账号ID
     $inputObj->SetMch_id(MCHID);
     //商户号
     $inputObj->SetSpbill_create_ip($_SERVER['REMOTE_ADDR']);
     //终端ip
     //$inputObj->SetSpbill_create_ip("1.1.1.1");
     $inputObj->SetNonce_str(self::getNonceStr());
     //随机字符串
     //签名
     $inputObj->SetSign();
     $xml = $inputObj->ToXml();
     $startTimeStamp = self::getMillisecond();
     //请求开始时间
     $response = self::postXmlCurl($xml, $url, false, $timeOut);
     $result = WxPayResults::Init($response);
     return $result;
 }
开发者ID:Alpha2016,项目名称:wxpay,代码行数:30,代码来源:WxPay.Api.php


示例7: unifiedOrder

 public function unifiedOrder($cart, $reference)
 {
     $total = (double) $cart->getOrderTotal(true, Cart::BOTH);
     $total = (int) ($total * 100);
     $detail = '';
     $nbProducts = $cart->nbProducts();
     if ($nbProducts > 1) {
         $detail = $this->module->l('Cart') . ' ' . $nbProducts . ' ' . $this->module->l('Products');
     } else {
         $products = $cart->getProducts();
         $detail = $products[0]['name'];
     }
     $time_start = date("YmdHis");
     $time_expire = date("YmdHis", time() + WXP_TIMEOUT);
     if (WXP_TIMEZONE != Configuration::get('PS_TIMEZONE')) {
         $china_timezone = new DateTimeZone(WXP_TIMEZONE);
         $system_timezone = new DateTimeZone(Configuration::get('PS_TIMEZONE'));
         $start = new DateTime($time_start, $system_timezone);
         $start->setTimezone($china_timezone);
         $time_start = $start->format("YmdHis");
         $expire = new DateTime($time_expire, $system_timezone);
         $expire->setTimezone($china_timezone);
         $time_expire = $expire->format("YmdHis");
     }
     $notify = new NativePay();
     $input = new WxPayUnifiedOrder();
     $input->SetBody($detail);
     $input->SetDetail($detail);
     $input->SetOut_trade_no($reference);
     $input->SetTotal_fee($total);
     $input->SetTime_start($time_start);
     $input->SetTime_expire($time_expire);
     $input->SetNotify_url(Configuration::get('WEIXIN_NOTIFY_URL'));
     $input->SetTrade_type("NATIVE");
     $input->SetProduct_id($reference);
     $result = $notify->getPayUrl($input);
     if (isset($result["code_url"])) {
         return $result["code_url"];
     }
     return false;
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:41,代码来源:payment.php


示例8: 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


示例9: wxpay

 public function wxpay()
 {
     //ajaxErrReturn('订单号必须');exit;
     if (!$_REQUEST['order_id'] && $_REQUEST['mo_id']) {
         ajaxErrReturn('订单号必须');
     }
     $model = M('order');
     if ($_REQUEST['order_id']) {
         $data['order_id'] = $_REQUEST['order_id'];
         $out_trade_no = $_REQUEST['order_id'];
     }
     if ($_GET['mo_id']) {
         $data['mo_id'] = $_REQUEST['mo_id'];
         $out_trade_no = $_REQUEST['mo_id'];
     }
     $data['member_id'] = $this->user['id'];
     $orders = $model->field('id,title,order_id,actual_paid,status')->where($data)->select();
     if (!$orders) {
         ajaxErrReturn('订单不存在');
     }
     $total_fee = 0;
     $title = '';
     foreach ($orders as $key => $order) {
         $total_fee += $order['actual_paid'];
         $titles[] = $order['title'];
         if ($order['status'] != 0) {
             ajaxErrReturn($order['order_id'] . '订单状态错误');
         }
     }
     $body = implode(',', $titles);
     $body = $body;
     $total_fee = $total_fee * 100;
     $total_fee = (string) $total_fee;
     require_once "../wxpay/lib/WxPay.Api.php";
     $input = new WxPayUnifiedOrder();
     $input->SetBody($body);
     //$input->SetAttach("test");
     $input->SetOut_trade_no($out_trade_no);
     $input->SetTotal_fee($total_fee);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     if ($_REQUEST['order_id']) {
         //单一订单支付
         $input->SetNotify_url(C('SITE_URL') . '/index.php/Wx_Payment/notify');
     }
     if ($_REQUEST['mo_id']) {
         //多订单合并支付
         $input->SetNotify_url(C('SITE_URL') . '/index.php/Wx_Payment/notify_merge');
     }
     //$input->SetNotify_url(C('SITE_URL') . '/index.php/Wx_Payment/notify_merge');
     $input->SetTrade_type("APP");
     //$input->SetOpenid($openId);
     $order = WxPayApi::unifiedOrder($input);
     $msg['appid'] = $order['appid'];
     $msg['partnerid'] = $order['mch_id'];
     $msg['prepayid'] = $order['prepay_id'];
     $msg['package'] = 'Sign=WXPay';
     $msg['noncestr'] = $order['nonce_str'];
     $msg['timestamp'] = time();
     //$this->json['sign'] = $order['sign'];
     //再次生成签名
     ksort($msg);
     //$string = $aa->ToUrlParams($this->json);
     $buff = "";
     foreach ($msg as $k => $v) {
         if ($k != "sign" && $v != "" && !is_array($v)) {
             $buff .= $k . "=" . $v . "&";
         }
     }
     $buff = trim($buff, "&");
     $string = $buff;
     //签名步骤二:在string后加入KEY
     $string = $string . "&key=" . WxPayConfig::KEY;
     //签名步骤三:MD5加密
     $string = md5($string);
     //签名步骤四:所有字符转为大写
     $result = strtoupper($string);
     $msg['sign'] = $result;
     //dump($msg);
     ajaxSucReturn($msg);
 }
开发者ID:8yong8,项目名称:vshop,代码行数:81,代码来源:OrderAction.class.php


示例10: finishOrder

 public function finishOrder()
 {
     $userInfo = session('userInfo');
     if (!$userInfo) {
         return;
     }
     $orderNo = I('get.orderno');
     $orderInfo = $this->getOrderInfoByNo($orderNo);
     if (!$orderInfo && !$orderInfo['tmp']) {
         return;
     }
     $userInfo = $this->getUserNewInfo($userInfo['id']);
     Vendor('WxPayApi.unit.log');
     Vendor('WxPayApi.lib.WxPayApi');
     Vendor('WxPayApi.unit.WxPayNativePay');
     //模式一
     $notify = new \NativePay();
     $input = new \WxPayUnifiedOrder();
     $input->SetBody("蒂罗尔曲奇商城订单");
     $input->SetAttach("goods");
     $input->SetOut_trade_no($orderInfo['orderNo']);
     $input->SetTotal_fee("1");
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetNotify_url("http://www.tyrolland.cn/Weixin/Pay/notify");
     $input->SetTrade_type("NATIVE");
     $input->SetProduct_id('TOPUP_' . $orderInfo['price']);
     $result = $notify->GetPayUrl($input);
     $url2 = $result["code_url"];
     $this->assign('orderInfo', $orderInfo);
     $this->assign('userInfo', $userInfo);
     $this->assign('url', urlencode($url2));
     $this->display();
 }
开发者ID:superSN,项目名称:tyrolland,代码行数:34,代码来源:ShopAction.class.php


示例11: CLogFileHandler

require_once 'log.php';
//初始化日志
$logHandler = new CLogFileHandler("../logs/" . date('Y-m-d') . '.log');
$log = Log::Init($logHandler, 15);
//打印输出数组信息
function printf_info($data)
{
    foreach ($data as $key => $value) {
        echo "<font color='#00ff55;'>{$key}</font> : {$value} <br/>";
    }
}
//①、获取用户openid
$tools = new JsApiPay();
$openId = $tools->GetOpenid();
//②、统一下单
$input = new WxPayUnifiedOrder();
$input->SetBody("6dygjsapi");
$input->SetAttach("6dygjsapi");
$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("6dygjsapi");
$input->SetNotify_url("http://mm.lmcity.cn/weipay/example/notify.php");
$input->SetTrade_type("JSAPI");
$input->SetOpenid($openId);
$order = WxPayApi::unifiedOrder($input);
echo '<font color="#f00"><b>统一下单支付单信息</b></font><br/>';
printf_info($order);
$jsApiParameters = $tools->GetJsApiParameters($order);
//获取共享收货地址js函数参数
开发者ID:king3388,项目名称:king,代码行数:31,代码来源:jsapi.php


示例12: printf_info

// require_once base_path().'/app/Library/Wxpay/example/log.php';
//初始化日志
// $logHandler= new CLogFileHandler("../logs/".date('Y-m-d').'.log');
// $log = Log::Init($logHandler, 15);
//打印输出数组信息
function printf_info($data)
{
    foreach ($data as $key => $value) {
        echo "<font color='#00ff55;'>{$key}</font> : {$value} <br/>";
    }
}
//①、获取用户openid
$tools = new JsApiPay();
$openId = $tools->GetOpenid();
//②、统一下单
$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("JSAPI");
$input->SetOpenid($openId);
$order = WxPayApi::unifiedOrder($input);
echo '<font color="#f00"><b>统一下单支付单信息</b></font><br/>';
printf_info($order);
$jsApiParameters = $tools->GetJsApiParameters($order);
//获取共享收货地址js函数参数
开发者ID:verchielxy,项目名称:ttx,代码行数:31,代码来源:pay.blade.php


示例13: NativePay

 * 3、确定支付之后,微信服务器会回调预先配置的回调地址,在【微信开放平台-微信支付-支付配置】中进行配置
 * 4、在接到回调通知之后,用户进行统一下单支付,并返回支付信息以完成支付(见:native_notify.php)
 * 5、支付完成之后,微信服务器会通知支付成功
 * 6、在支付成功通知中需要查单确认是否真正支付成功(见:notify.php)
 */
$notify = new NativePay();
$url1 = $notify->GetPrePayUrl("123456789");
//模式二
/**
 * 流程:
 * 1、调用统一下单,取得code_url,生成二维码
 * 2、用户扫描二维码,进行支付
 * 3、支付完成之后,微信服务器会通知支付成功
 * 4、在支付成功通知中需要查单确认是否真正支付成功(见:notify.php)
 */
$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->SetProduct_id("123456789");
$result = $notify->GetPayUrl($input);
$url2 = $result["code_url"];
?>

<html>
开发者ID:1290800466,项目名称:weixin_pay,代码行数:31,代码来源:native.php


示例14: header

header('Access-Control-Allow-Origin: *');
header('Content-type: text/plain');
require_once "WxPay.Api.php";
require_once "WxPay.Data.php";
// 获取支付金额
$amount = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $amount = $_POST['total'];
} else {
    $amount = $_GET['total'];
}
$total = floatval($amount);
$total = round($total * 100);
// 将元转成分
if (empty($total)) {
    $total = 100;
}
// 商品名称
$subject = 'DCloud项目捐赠';
// 订单号,示例代码使用时间值作为唯一的订单ID号
$out_trade_no = date('YmdHis', time());
$unifiedOrder = new WxPayUnifiedOrder();
$unifiedOrder->SetBody($subject);
//商品或支付单简要描述
$unifiedOrder->SetOut_trade_no($out_trade_no);
$unifiedOrder->SetTotal_fee($total);
$unifiedOrder->SetTrade_type("APP");
$result = WxPayApi::unifiedOrder($unifiedOrder);
if (is_array($result)) {
    echo json_encode($result);
}
开发者ID:peaceleo,项目名称:H5P.Server,代码行数:31,代码来源:index.php


示例15: get_pay_url

function get_pay_url($charge_type, $pay_amount, $payment_config, $subject, $order_id, $model_id = null, $obj_id = null, $service = null, $sign_type = 'MD5', $show_url = 'index.php?do=user&view=finance&op=details')
{
    global $_K, $uid, $username;
    $charge_type == 'order_charge' and $t = "订单充值" or $t = "余额充值";
    $body = $t . "(from:" . $username . ")";
    $notify = new NativePay();
    $WxPayCfg = new WxPayCfg();
    $Out_trade_no = $WxPayCfg->_mchid . date("YmdHis");
    $attach = "charge-{$charge_type}-{$uid}-{$obj_id}-{$order_id}-{$model_id}-" . time();
    $input = new WxPayUnifiedOrder();
    $input->SetBody($body);
    $input->SetDetail($body);
    $input->SetAttach($attach);
    $input->SetOut_trade_no($Out_trade_no);
    $input->SetFee_type("CNY");
    $input->SetTotal_fee($pay_amount * 100);
    $input->SetTime_start(date("YmdHis"));
    $input->SetTime_expire(date("YmdHis", time() + 600));
    $input->SetNotify_url(BASE_WXPAY_URL . "notify.php");
    $input->SetTrade_type("NATIVE");
    $input->SetProduct_id($obj_id);
    $result = $notify->GetPayUrl($input);
    $url2 = $result["code_url"];
    keke_order_class::create_order_charge('online_charge', 'wxpay', null, $obj_id, $uid, $username, $pay_amount, 'wait', '用户充值', $Out_trade_no, null, $attach);
    $baseUrl = urlencode($url2);
    $data = array();
    $data['url'] = BASE_WXPAY_URL . "qrcode.php?data=" . $baseUrl;
    $data['out_trade_no'] = $Out_trade_no;
    return $data;
}
开发者ID:huangbinzd,项目名称:kppwGit,代码行数:30,代码来源:order.php


示例16: index

 public function index()
 {
     //echo "one";
     $this->load->library('wxpayexception');
     define('APPID', $this->config->get('wxpay_appid'));
     define('MCHID', $this->config->get('wxpay_mchid'));
     define('KEY', $this->config->get('wxpay_key'));
     define('APPSECRET', $this->config->get('wxpay_appsecret'));
     //echo "three";
     $this->load->library('wxpaydata');
     //echo "four";
     $this->load->library('wxpayapi');
     //echo "five";
     $this->load->library('wxpaynativepay');
     //echo "six";
     $this->language->load('payment/qrcode_wxpay');
     $data['button_confirm'] = $this->language->get('button_confirm');
     $this->load->model('checkout/order');
     $order_id = $this->session->data['order_id'];
     $order_info = $this->model_checkout_order->getOrder($order_id);
     $item_name = $this->config->get('config_name');
     $fullname = $order_info['payment_fullname'];
     $this->load->model('account/order');
     $shipping_cost = 0;
     $totals = $this->model_account_order->getOrderTotals($order_id);
     foreach ($totals as $total) {
         if ($total['title'] == 'shipping') {
             $shipping_cost = $total['value'];
         }
     }
     $notify_url = HTTPS_SERVER . 'catalog/controller/payment/qrcode_wxpay_callback.php';
     $out_trade_no = $this->session->data['order_id'];
     $subject = $item_name . ' ' . $this->language->get('text_order') . ' ' . $order_id;
     $amount = $order_info['total'];
     $currency_value = $this->currency->getValue('CNY');
     $price = $amount * $currency_value;
     $price = number_format($price, 2, '.', '');
     $total_fee = $price * 100;
     //乘100去掉小数点,以传递整数给微信支付
     //$total_fee = 1;
     //echo "Total Fee: ".$total_fee."<br>";
     //echo "3";
     //$openId = $this->session->data['weixin_openid'];
     $notify = new NativePay();
     $input = new WxPayUnifiedOrder();
     $input->SetBody($subject);
     $input->SetAttach("mycncart");
     $input->SetOut_trade_no($order_id);
     $input->SetTotal_fee($total_fee);
     $input->SetTime_start(date("YmdHis"));
     $input->SetTime_expire(date("YmdHis", time() + 600));
     $input->SetGoods_tag("mycncart");
     $input->SetNotify_url(HTTP_SERVER . "catalog/controller/payment/qrcode_wxpay_callback.php");
     $input->SetTrade_type("NATIVE");
     $input->SetProduct_id($order_id);
     $result = $notify->GetPayUrl($input);
     //$url2 = $result["code_url"];
     $this->session->data['code_url'] = $result['code_url'];
     $data['redirect'] = $this->url->link('checkout/qrcode_wxpay_success');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/qrcode_wxpay.tpl')) {
         return $this->load->view($this->config->get('config_template') . '/template/payment/qrcode_wxpay.tpl', $data);
     } else {
         return $this->load->view('default/template/payment/qrcode_wxpay.tpl', $data);
     }
 }
开发者ID:monkeychen,项目名称:website,代码行数:65,代码来源:qrcode_wxpay.php


示例17: pay_get

 public function pay_get()
 {
     $order = I('get.order', '');
     $m = M('orders');
     // $map['from_member_id'] = $this->uid;
     $map['order_number'] = $order;
     // $map['status'] = 0;
     $info = $m->where($map)->find();
     if (empty($info)) {
         //未支付订单不存在
         $this->error(5015);
     }
     $total = $info['total'] * 100;
     $describe = 'testname';
     require_once APP_PATH . "SDK/Payment/wechat/lib/WxPay.Api.php";
     $input = new \WxPayUnifiedOrder();
     //设置公众账号ID
     $input->SetAppid(\WxPayConfig::APPID);
     //设置商户号
     $input->SetMch_id(\WxPayConfig::MCHID);
     //设置随机字符串
     $input->SetNonce_str(\WxPayApi::getNonceStr());
     //设置商品描述
     $input->SetBody($describe);
     //设置商户订单号
     $input->SetOut_trade_no($info['order_number']);
     //设置总金额
     $input->SetTotal_fee($total);
     //设置终端IP
     $input->SetSpbill_create_ip(get_client_ip());
     //设置通知地址
     $input->SetNotify_url(U('Wxpay/callback@api'));
     //设置交易类型
     $input->SetTrade_type('APP');
     $order = \WxPayApi::unifiedOrder($input);
     $this->success($order);
 }
开发者ID:jkzleond,项目名称:alhelp_api,代码行数:37,代码来源:WxpayController.class.php


示例18: 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


示例19: trim

}
if ($phone != 0) {
    $str .= '手机壳x' . $phone . ',';
}
if ($pillow != 0) {
    $str .= '抱枕x' . $pillow . ',';
}
if ($bag != 0) {
    $str .= '手提袋x' . $bag . ',';
}
if ($battery != 0) {
    $str .= '移动电源x' . $battery . ',';
}
$body = trim($str, ',');
try {
    $input = new WxPayUnifiedOrder();
    $input->SetBody("奇艺果定制商品");
    $input->SetAttach("奇艺果定制商品");
    $input->SetOut_trade_no($order_sn);
    $input->SetTotal_fee($money_paid);
    $input->SetTime_start(date("YmdHis"));
    $input->SetTime_expire(date("YmdHis", time() + 600));
    $input->SetGoods_tag("test");
    $input->SetNotify_url(URL . "pays/wxpay_saoma/example/notify.php");
    $input->SetTrade_type("NATIVE");
    $input->SetProduct_id($order_id);
    $result = $notify->GetPayUrl($input);
    $url2 = $result["code_url"];
} catch (Exception $e) {
    echo "系统繁忙,请稍后再试。";
    exit;
开发者ID:lughong,项目名称:test,代码行数:31,代码来源:native.php


示例20: printf_info

$log = Log::Init($logHandler, 15);
// 打印输出数组信息
function printf_info($data)
{
    foreach ($data as $key => $value) {
        echo "<font color='#00ff55;'>{$key}</font> : {$value} <br/>";
    }
}
// ①、获取用户openid
$tools = new JsApiPay();
$openId = $tools->GetOpenid();
if (empty($openId)) {
    return false;
}
// ②、统一下单
$input = new WxPayUnifiedOrder();
$input->SetBody($_GET['body']);
$input->SetAttach("test");
$input->SetOut_trade_no($_GET['order_sn']);
$input->SetTotal_fee($_GET['money']);
$input->SetTime_start(date("YmdHis"));
$input->SetTime_expire(date("YmdHis", time() + 600));
$input->SetGoods_tag("test");
$input->SetNotify_url($_GET['url'] . "Wxpay/example/notify.php");
$input->SetTrade_type("JSAPI");
$input->SetOpenid($openId);
$order = WxPayApi::unifiedOrder($input);
// echo '<font color="#f00"><b>统一下单支付单信息</b></font><br/>';
// printf_info($order);
$jsApiParameters = $tools->GetJsApiParameters($order);
$success_url = $_GET['url'] . "index.php?g=weixin&m=scan&a=success_pay&order_sn={$_GET['order_sn']}";
开发者ID:xiaoxianlink,项目名称:weixin,代码行数:31,代码来源:jsapi.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP X2Html类代码示例发布时间:2022-05-23
下一篇:
PHP WxPayOrderQuery类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap