本文整理汇总了PHP中WxPayUnifiedOrder::SetProduct_id方法的典型用法代码示例。如果您正苦于以下问题:PHP WxPayUnifiedOrder::SetProduct_id方法的具体用法?PHP WxPayUnifiedOrder::SetProduct_id怎么用?PHP WxPayUnifiedOrder::SetProduct_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WxPayUnifiedOrder
的用法示例。
在下文中一共展示了WxPayUnifiedOrder::SetProduct_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: topup
public function topup()
{
$orderInfo = session('orderInfo');
Vendor('WxPayApi.unit.log');
Vendor('WxPayApi.lib.WxPayApi');
Vendor('WxPayApi.unit.WxPayNativePay');
//模式一
$notify = new \NativePay();
$input = new \WxPayUnifiedOrder();
$input->SetBody("会员充值");
$input->SetAttach("topup");
$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"];
$userInfo = session('userInfo');
$this->assign('orderInfo', $orderInfo);
$this->assign('userInfo', $userInfo);
$this->assign('url', urlencode($url2));
$this->display();
}
示例3: qrcode
/**
* 生成微信支付二维码
*/
public static function qrcode($product_id, $body, $total_fee, $attach = '', $detail = '', $goods_tag = '')
{
// 处理金额
if (ENV_SCENE == 'dev') {
$total_fee = 0.01;
}
$total_fee *= 100;
$notify = new NativePay();
/**
* 流程:
* 1、调用统一下单,取得code_url,生成二维码
* 2、用户扫描二维码,进行支付
* 3、支付完成之后,微信服务器会通知支付成功
* 4、在支付成功通知中需要查单确认是否真正支付成功(见:notify.php)
*/
$input = new WxPayUnifiedOrder();
$input->SetBody($body);
$input->SetAttach($product_id);
if (!empty($detail)) {
$input->SetDetail($detail);
}
$input->SetOut_trade_no(WxPayConfig::$APPID . substr($product_id, 1));
$input->SetTotal_fee($total_fee);
$input->SetTime_start(date("YmdHis"));
$input->SetTime_expire(date("YmdHis", time() + 600));
if (!empty($goods_tag)) {
$input->SetGoods_tag($goods_tag);
}
$input->SetNotify_url(WxPayConfig::$NOTIFY_URL);
$input->SetTrade_type("NATIVE");
$input->SetProduct_id($product_id);
$result = $notify->GetPayUrl($input);
return $result["code_url"];
}
示例4: get_payurl
/**
* 组装包含支付信息的url(模式2)
*/
public function get_payurl()
{
require_once BASE_PATH . '/api/payment/wxpay/lib/WxPay.Api.php';
require_once BASE_PATH . '/api/payment/wxpay/WxPay.NativePay.php';
require_once BASE_PATH . '/api/payment/wxpay/log.php';
$logHandler = new CLogFileHandler(BASE_DATA_PATH . '/log/wxpay/' . date('Y-m-d') . '.log');
$Logwx = Logwx::Init($logHandler, 15);
//统一下单
$input = new WxPayUnifiedOrder();
$input->SetBody($this->_order_info['pay_sn'] . '订单');
// $input->SetBody(C('site_name').'订单');
$input->SetAttach($this->_order_info['order_type'] == 'vr_order' ? 'v' : 'r');
$input->SetOut_trade_no($this->_order_info['pay_sn']);
$input->SetTotal_fee($this->_order_info['api_pay_amount'] * 100);
$input->SetTime_start(date("YmdHis"));
$input->SetTime_expire(date("YmdHis", time() + 3600));
$input->SetGoods_tag('');
$input->SetNotify_url(SHOP_SITE_URL . '/api/payment/wxpay/notify_url.php');
$input->SetTrade_type("NATIVE");
//$input->SetOpenid($openId);
$input->SetProduct_id($this->_order_info['pay_sn']);
$result = WxPayApi::unifiedOrder($input);
// header("Content-type:text/html;charset=utf-8");
// print_R($result);exit;
Logwx::DEBUG("unifiedorder-:" . json_encode($result));
return $result["code_url"];
}
示例5: unifiedorder
public function unifiedorder($openId, $product_id)
{
//得到支付金额
$order_pay_info = Model('order')->getOrderPayInfo(array('pay_sn' => $product_id));
if (empty($order_pay_info)) {
$condition = array();
$condition['order_sn'] = $product_id;
$condition['order_state'] = ORDER_STATE_NEW;
$order_info = Model('vr_order')->getOrderInfo($condition, 'sum(order_amount-rcb_amount-pd_amount) as order_amount');
$attach = 'v';
} else {
$condition = array();
$condition['pay_sn'] = $product_id;
$condition['order_state'] = ORDER_STATE_NEW;
$order_info = Model('order')->getOrderInfo($condition, array(), 'sum(order_amount-rcb_amount-pd_amount) as order_amount');
$attach = 'r';
}
//统一下单
$input = new WxPayUnifiedOrder();
$input->SetBody($product_id . '订单');
// $input->SetBody(C('site_name').'订单');
$input->SetAttach($attach);
$input->SetOut_trade_no($product_id);
$input->SetTotal_fee($order_info['order_amount'] * 100);
$input->SetTime_start(date("YmdHis"));
$input->SetTime_expire(date("YmdHis", time() + 3600));
$input->SetGoods_tag('');
$input->SetNotify_url(SHOP_SITE_URL . '/api/payment/wxpay/notify_url.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;
}
示例6: index
public function index()
{
require_once DIR_SYSTEM . 'library/wxpay/wxpayexception.php';
define('WXPAY_APPID', trim($this->config->get('wxpay_appid')));
define('WXPAY_MCHID', trim($this->config->get('wxpay_mchid')));
define('WXPAY_KEY', trim($this->config->get('wxpay_key')));
define('WXPAY_APPSECRET', trim($this->config->get('wxpay_appsecret')));
define('WXPAY_SSLCERT_PATH', DIR_SYSTEM . 'helper/wxpay_key/apiclient_cert.pem');
define('WXPAY_SSLKEY_PATH', DIR_SYSTEM . 'helper/wxpay_key/apiclient_key.pem');
define('WXPAY_CURL_PROXY_HOST', "0.0.0.0");
define('WXPAY_CURL_PROXY_PORT', 0);
define('REPORT_LEVENL', 1);
require_once DIR_SYSTEM . 'library/wxpay/wxpayconfig.php';
require_once DIR_SYSTEM . 'library/wxpay/wxpaydata.php';
require_once DIR_SYSTEM . 'library/wxpay/wxpayapi.php';
require_once DIR_SYSTEM . 'library/wxpay/wxpaynativepay.php';
$this->load->language('extension/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/extension/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去掉小数点,以传递整数给微信支付
$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(HTTPS_SERVER . "catalog/controller/extension/payment/qrcode_wxpay_callback.php");
$input->SetTrade_type("NATIVE");
$input->SetProduct_id($order_id);
$result = $notify->GetPayUrl($input);
$this->session->data['code_url'] = $result['code_url'];
$data['redirect'] = $this->url->link('checkout/qrcode_wxpay_success');
return $this->load->view('extension/payment/qrcode_wxpay', $data);
}
示例7: pay
public function pay($title, $price)
{
$notify = new NativePay();
$input = new WxPayUnifiedOrder();
$input->SetBody($title);
$input->SetAttach($title);
$input->SetOut_trade_no(WxPayConfig::MCHID . date("YmdHis"));
$input->SetTotal_fee($price);
$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"];
return $url;
}
示例8: 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;
}
示例9: 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;
}
示例10: weixinPayment
/**
* [paymenttList 微信支付页面]
* @Author 罗江涛
* @DateTime 2016-03-07T17:01:37+0800
*/
public function weixinPayment()
{
$title = I("title");
$price = I("price");
$reportId = I("reportId");
$userId = I("userId");
ini_set('date.timezone', 'Asia/Shanghai');
require "./Application/Index/Service/weixinPayApi/WxPay.Api.php";
require "./Application/Index/Service/weixinPayApi/WxPay.NativePay.php";
//模式二
$notify = new \NativePay();
/**
* 流程:
* 1、调用统一下单,取得code_url,生成二维码
* 2、用户扫描二维码,进行支付
* 3、支付完成之后,微信服务器会通知支付成功
* 4、在支付成功通知中需要查单确认是否真正支付成功(见:notify.php)
*/
// $input = new \Index\Service\weixinPayApi\lib\WxPayUnifiedOrder();
$input = new \WxPayUnifiedOrder();
$input->SetBody($title);
$input->SetAttach($userId . "|" . $reportId);
$input->SetOut_trade_no(\WxPayConfig::MCHID . date("YmdHis"));
// $input->SetOut_trade_no($reportId);
$input->SetTotal_fee($price);
$input->SetTime_start(date("YmdHis"));
$input->SetTime_expire(date("YmdHis", time() + 600));
$input->SetGoods_tag("SetGoods_tag");
// $input->SetNotify_url("http://qingdao.luojiangtao.com/index.php/Api/Payment/getWeixinPaymentInfo");
// $input->SetNotify_url(U("Api/Payment/getWeixinPayPost"));
$input->SetNotify_url("http://qingdao.luojiangtao.com/vcbeat/index.php/Api/Payment/getWeixinPayPost");
$input->SetTrade_type("NATIVE");
$input->SetProduct_id("123456789");
// p($_SERVER);die;
$result = $notify->GetPayUrl($input);
$url2 = $result["code_url"];
// p($result);die;
// $this->assign("url2", $url2);
$this->url2 = $url2;
$this->display();
}
示例11: dirname
<?php
require dirname(dirname(dirname(__FILE__))) . '/include/common.inc.php';
require_once SLINEINC . "/view.class.php";
$pv = new View();
require_once "lib/WxPay.Api.php";
require_once "example/WxPay.NativePay.php";
require_once 'example/log.php';
$notify = new NativePay();
$input = new WxPayUnifiedOrder();
$input->SetBody($_POST['subject']);
$input->SetAttach("");
$input->SetOut_trade_no($_POST['ordersn']);
$input->SetTotal_fee($_POST['price'] * 100);
$input->SetTime_start(date("YmdHis"));
$input->SetTime_expire(date("YmdHis", time() + 600));
$input->SetGoods_tag("");
$input->SetNotify_url($GLOBALS['cfg_basehost'] . '/thirdpay/weixinpay/notify.php');
$input->SetTrade_type("NATIVE");
$input->SetProduct_id($_POST['ordersn']);
$result = $notify->GetPayUrl($input);
$url2 = urlencode($result["code_url"]);
$templet = SLINEROOT . '/thirdpay/weixinpay/tpl/native.htm';
$pv->SetTemplet($templet);
$pv->Display();
exit;
?>
示例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;
}
示例13: wechatPay
private function wechatPay ($order, $good, $orderPrice)
{
require_once('lib/WxPay.Api.php');
require_once('WxPay.NativePay.php');
require_once('log.php');
require_once('lib/phpqrcode.php');
$notify = new \NativePay();
$notify_url = $this->debug ? "http://www.51linpai.com:8000/order/wxpay/" : "http://www.51linpai.com/order/wxpay";
$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("NATIVE");
$input->SetProduct_id($good->id . '_' . $good->code);
$result = $notify->GetPayUrl($input);
$url2 = $result["code_url"];
$path = storage_path() . '/app/pay_code/';
$file = $order->code . '.png';
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
$png = \QRcode::png($url2, $path . $file);
$qrcode = '/imgs/wxpay_qrcode/' . $file;
Session::put('unpayed_order', $order->code);
return view('wxpay', [ 'qrcode' => $qrcode,
'price' => $orderPrice->final_price,
'good' => $good,
'order_code' => $order->code
]);
}
示例14: 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();
}
示例15: balance_deposit2
//.........这里部分代码省略.........
//通知地址
$unifiedOrder->setParameter("trade_type", "JSAPI");
//交易类型
$prepay_id = $unifiedOrder->getPrepayId();
$jsApi->setPrepayId($prepay_id);
$jsApiParameters = $jsApi->getParameters();
if (!empty($jsApiParameters)) {
$json_result = json_decode($jsApiParameters);
$code_url = isset($json_result->paySign) ? $jsApiParameters : '';
$this->set('url2', $code_url);
}
} else {
throw new SDKRuntimeException("支付失败,OpenId 获取失败");
}
} else {
$this->layout = "ajax";
$wechatpay_type = true;
App::import('Vendor', 'Weixinpay', array('file' => 'WxPay.Api.php'));
App::import('Vendor', 'Phpqcode', array('file' => 'phpqrcode.php'));
$input = new WxPayUnifiedOrder();
$notify = new NativePay();
$input->SetKey($payment_config['KEY']);
$input->SetBody($order_code);
$input->SetAttach($order_code);
$input->SetOut_trade_no($order_code);
$input->SetAppid($payment_config['APPID']);
$input->SetMch_id($payment_config['MCHID']);
$input->SetTotal_fee($amt);
$input->SetTime_start(date("YmdHis"));
$input->SetTime_expire(date("YmdHis", time() + 600));
$input->SetGoods_tag($order_code);
$input->SetNotify_url('http://' . $host . $this->webroot . 'responds/weixin_notify');
$input->SetTrade_type("NATIVE");
$input->SetProduct_id($order_code);
$result = $notify->GetPayUrl($input);
$url2 = isset($result["code_url"]) ? $result["code_url"] : '';
$this->set('url2', $url2);
}
$this->set('order_code', $order_code);
$this->set('wechatpay_type', $wechatpay_type);
} else {
$pay_form_txt = "";
$host = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '');
if ($this->RequestHandler->isMobile() && $payment['Payment']['code'] == 'alipay') {
//手机支付宝支付访问
$payment_api_log = array('payment_code' => $payment['Payment']['code'], 'type' => 1, 'type_id' => $orderid, 'order_id' => $order_code, 'order_currency' => 'CHY', 'amount' => $amount_money);
$this->PaymentApiLog->save($payment_api_log);
$alipay_config = array();
//合作身份者id,以2088开头的16位纯数字
$alipay_config['partner'] = isset($payment_config['partner']) ? $payment_config['partner'] : '';
//收款支付宝账号,一般情况下收款账号就是签约账号
$alipay_config['seller_id'] = isset($payment_config['partner']) ? $payment_config['partner'] : '';
//商户的私钥(后缀是.pen)文件相对路径
$alipay_config['private_key_path'] = ROOT . '/vendors/payments/alipaywap/key/rsa_private_key.pem';
//支付宝公钥(后缀是.pen)文件相对路径
$alipay_config['ali_public_key_path'] = ROOT . '/vendors/payments/alipaywap/key/rsa_public_key.pem';
//签名方式 不需修改
$alipay_config['sign_type'] = strtoupper('RSA');
//字符编码格式 目前支持 gbk 或 utf-8
$alipay_config['input_charset'] = strtolower('utf-8');
//ca证书路径地址,用于curl中ssl校验
//请保证cacert.pem文件在当前文件夹目录中
$alipay_config['cacert'] = ROOT . '/vendors/payments/alipaywap/cacert.pem';
//访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
$alipay_config['transport'] = 'http';
if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false && $payment['Payment']['code'] == 'alipay') {