public function pay() { $orderName = $_GET['orderName']; if (!$orderName) { $orderName = microtime(); } $orderid = $_GET['orderid']; if (!$orderid) { $orderid = $_GET['single_orderid']; } $payHandel = new payHandle($this->token, $_GET['from'], 'yeepay'); $orderInfo = $payHandel->beforePay($orderid); if ($orderInfo['paid']) { exit('您已经支付过此次订单!'); } if (!$orderInfo['price']) { exit('必须有价格才能支付!'); } $database_yeepay_tmp = M('Yeepay_tmp'); $data_yeepay_tmp['order_id'] = $orderid; $data_yeepay_tmp['token'] = $this->token; $data_yeepay_tmp['wecha_id'] = $this->wecha_id; $data_yeepay_tmp['from'] = $_GET['from']; $data_yeepay_tmp['time'] = $_SERVER['REQUEST_TIME']; if (!empty($_GET['platform'])) { $data_yeepay_tmp['platform'] = 1; } if (!($tmp_id = $database_yeepay_tmp->data($data_yeepay_tmp)->add())) { $this->error('下订单出现错误!请重试。'); } import('@.ORG.Yeepay.yeepayMPay'); $yeepay = new yeepayMPay($this->payConfig['merchantaccount'], $this->payConfig['merchantPublicKey'], $this->payConfig['merchantPrivateKey'], $this->payConfig['yeepayPublicKey']); $order_id = 'ORDER_' . $tmp_id; $transtime = time(); $product_catalog = '1'; $identity_id = $this->wecha_id; $identity_type = 0; $user_ip = $_SERVER['REMOTE_ADDR']; $user_ua = $_SERVER['HTTP_USER_AGENT']; $callbackurl = C('site_url') . '/index.php?g=Wap&m=Yeepay&a=notify_url'; $fcallbackurl = C('site_url') . '/wxpay/yeepay.php'; $product_name = $orderName; $product_desc = $orderName; $other = ''; $amount = floatval($orderInfo['price'] * 100); $url = $yeepay->webPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $callbackurl, $fcallbackurl, $currency = 156, $product_name, $product_desc, $other); $_SESSION['yeepay']['token'] = $this->token; header('Location: ' . $url); exit; }
public function mobile_pay() { import("@.ORG.pay.Yeepay.yeepayMPay"); $yeepay = new yeepayMPay($this->pay_config["pay_yeepay_merchantaccount"], $this->pay_config["pay_yeepay_merchantpublickey"], $this->pay_config["pay_yeepay_merchantprivatekey"], $this->pay_config["pay_yeepay_yeepaypublickey"]); $order_id = $this->order_info["order_type"] . "_" . $this->order_info["order_id"]; $transtime = $_SERVER["REQUEST_TIME"]; $product_catalog = $this->pay_config["pay_yeepay_productcatalog"]; $identity_id = "user_" . $this->user_info["uid"]; $identity_type = 0; $user_ip = get_client_ip(); $user_ua = $_SERVER["HTTP_USER_AGENT"]; $callbackurl = C("config.site_url") . "/wap.php?c=Pay&a=return_url&pay_type=yeepay&is_mobile=1"; $fcallbackurl = C("config.site_url") . "/source/m_yeepay.php"; $product_name = $this->order_info["order_name"]; $product_desc = $this->order_info["order_name"] . "_" . $this->order_info["order_num"]; $other = ""; $amount = floatval($this->order_info["order_total_money"] * 100); $url = $yeepay->webPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $callbackurl, $fcallbackurl, $currency = 156, $product_name, $product_desc, $other); return array("error" => 0, "url" => $url); }
public function pay() { if (empty($this->pay_config['pay_yeepay_merchantaccount']) || empty($this->pay_config['pay_yeepay_merchantprivatekey']) || empty($this->pay_config['pay_yeepay_merchantpublickey']) || empty($this->pay_config['pay_yeepay_yeepaypublickey']) || empty($this->pay_config['pay_yeepay_productcatalog'])) { return array('err_code' => 1, 'err_msg' => '易宝支付缺少配置信息!请联系管理员处理或选择其他支付方式。'); } import('source.class.pay.Yeepay.yeepayMPay'); $yeepay = new yeepayMPay($this->pay_config['pay_yeepay_merchantaccount'], $this->pay_config['pay_yeepay_merchantpublickey'], $this->pay_config['pay_yeepay_merchantprivatekey'], $this->pay_config['pay_yeepay_yeepaypublickey']); $order_id = $this->order_info['trade_no']; $transtime = $_SERVER['REQUEST_TIME']; $product_catalog = $this->pay_config['pay_yeepay_productcatalog']; $identity_id = session_id(); $identity_type = 0; $user_ip = $_SERVER['REMOTE_ADDR']; $user_ua = $_SERVER['HTTP_USER_AGENT']; $callbackurl = option('config.wap_site_url') . '/paynotice.php?pay_type=yeepay'; $fcallbackurl = option('config.wap_site_url') . '/paycallback.php?orderno=' . $this->order_info['order_no_txt']; $product_name = '订单号:' . $this->order_info['order_no_txt']; $product_desc = '订单号:' . $this->order_info['order_no_txt'] . ';订单数量:' . $this->order_info['pro_num']; $other = ''; $amount = floatval($this->order_info['total'] * 100); $url = $yeepay->webPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $callbackurl, $fcallbackurl, $currency = 156, $product_name, $product_desc, $other); return array('err_code' => 0, 'url' => $url); }
public function get_payment_code($payment_notice_id) { include APP_ROOT_PATH . "system/payment/yeepay/yeepayMPay.php"; $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']); $sql = "select name " . "from " . DB_PREFIX . "deal " . "where id =" . intval($payment_notice['deal_id']); $title_name = $GLOBALS['db']->getOne($sql); $subject = $order_sn; $yeepay = new yeepayMPay($payment_info['config']['merchantaccount'], $payment_info['config']['merchantPublicKey'], $payment_info['config']['merchantPrivateKey'], $payment_info['config']['yeepayPublicKey']); //$notify_url = get_domain().APP_ROOT."/yeepay_web/alipayapi.php?order_id=".intval($payment_notice['order_id'])."&out_trade_no=".$order_sn;//."&out_trade_no={$data.walipay.out_trade_no}"; $data_return_url = get_domain() . APP_ROOT . '/yeepay_web/yjwap_response.php'; $data_notify_url = get_domain() . APP_ROOT . '/yeepay_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); $order_id = $order_sn; //网页支付的订单在订单有效期内可以进行多次支付请求,但是需要注意的是每次请求的业务参数都要一致,交易时间也要保持一致。否则会报错“订单与已存在的订单信息不符” $transtime = NOW_TIME; // time();//交易时间,是每次支付请求的时间,注意此参数在进行多次支付的时候要保持一致。 $product_catalog = $payment_info['config']['productcatalog']; //商品类编码是我们业管根据商户业务本身的特性进行配置的业务参数。 $identity_id = $payment_notice['user_id']; //用户身份标识,是生成绑卡关系的因素之一,在正式环境此值不能固定为一个,要一个用户有唯一对应一个用户标识,以防出现盗刷的风险且一个支付身份标识只能绑定5张银行卡 $identity_type = 2; //支付身份标识类型码 require_once APP_ROOT_PATH . 'system/extend/ip.php'; $iplocation = new iplocate(); $user_ip = $iplocation->getIP(); //此参数不是固定的商户服务器IP,而是用户每次支付时使用的网络终端IP,否则的话会有不友好提示:“检测到您的IP地址发生变化,请注意支付安全”。 $user_ua = $_SERVER['HTTP_USER_AGENT']; //'NokiaN70/3.0544.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1';//用户ua $callbackurl = $data_notify_url; //商户后台系统回调地址,前后台的回调结果一样 $fcallbackurl = $data_return_url; //商户前台系统回调地址,前后台的回调结果一样 $product_name = '订单号-' . $title_name; //出于风控考虑,请按下面的格式传递值:应用-商品名称,如“诛仙-3 阶成品天琊” $product_desc = ''; //商品描述 $terminaltype = 3; $terminalid = ''; //其他支付身份信息 $amount = $money * 100; //订单金额单位为分,支付时最低金额为2分,因为测试和生产环境的商户都有手续费(如2%),易宝支付收取手续费如果不满1分钱将按照1分钱收取。 $url = $yeepay->webPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $callbackurl, $fcallbackurl, $currency = 156, $product_name, $product_desc, $terminaltype, $terminalid, $orderexp_date = 60); $pay = array(); $pay['subject'] = $subject; $pay['body'] = $title_name; $pay['total_fee'] = $money; $pay['total_fee_format'] = format_price($money); $pay['out_trade_no'] = $payment_notice['notice_sn']; $pay['notify_url'] = $url; $pay['is_wap'] = 1; $pay['pay_code'] = 'wyeepay'; //,支付宝;mtenpay,财付通;mcod,货到付款 return $pay; }
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 = $GLOBALS['db']->getRow("select order_sn,user_id from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']); $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']); $order_sn = $order['order_sn']; $user_id = $order['user_id']; include "yeepay/yeepayMPay.php"; $yeepay = new yeepayMPay($payment_info['config']['merchantaccount'], $payment_info['config']['merchantPublicKey'], $payment_info['config']['merchantPrivateKey'], $payment_info['config']['yeepayPublicKey']); //print_r($payment_info['config']);exit; $data_return_url = SITE_DOMAIN . APP_ROOT . '/callback/pay/yjwap_response.php'; $data_notify_url = SITE_DOMAIN . APP_ROOT . '/callback/pay/yjwap_notify.php'; $data_return_url = str_replace("/mapi", "", $data_return_url); $data_notify_url = str_replace("/mapi", "", $data_notify_url); $order_id = $payment_notice['notice_sn']; //网页支付的订单在订单有效期内可以进行多次支付请求,但是需要注意的是每次请求的业务参数都要一致,交易时间也要保持一致。否则会报错“订单与已存在的订单信息不符” $transtime = get_gmtime(); // time();//交易时间,是每次支付请求的时间,注意此参数在进行多次支付的时候要保持一致。 $product_catalog = '1'; //商品类编码是我们业管根据商户业务本身的特性进行配置的业务参数。 $identity_id = $user_id; //用户身份标识,是生成绑卡关系的因素之一,在正式环境此值不能固定为一个,要一个用户有唯一对应一个用户标识,以防出现盗刷的风险且一个支付身份标识只能绑定5张银行卡 $identity_type = 2; //支付身份标识类型码 $user_ip = get_client_ip(); //此参数不是固定的商户服务器IP,而是用户每次支付时使用的网络终端IP,否则的话会有不友好提示:“检测到您的IP地址发生变化,请注意支付安全”。 $user_ua = $_SERVER['HTTP_USER_AGENT']; //'NokiaN70/3.0544.5.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1';//用户ua $callbackurl = $data_notify_url; //商户后台系统回调地址,前后台的回调结果一样 $fcallbackurl = $data_return_url; //商户前台系统回调地址,前后台的回调结果一样 $product_name = '订单号-' . $order_sn; //出于风控考虑,请按下面的格式传递值:应用-商品名称,如“诛仙-3 阶成品天琊” $product_desc = ''; //商品描述 $terminaltype = 3; $terminalid = ''; //其他支付身份信息 $amount = $money * 100; //订单金额单位为分,支付时最低金额为2分,因为测试和生产环境的商户都有手续费(如2%),易宝支付收取手续费如果不满1分钱将按照1分钱收取。 $url = $yeepay->webPay($order_id, $transtime, $amount, $product_catalog, $identity_id, $identity_type, $user_ip, $user_ua, $callbackurl, $fcallbackurl, $currency = 156, $product_name, $product_desc, $terminaltype, $terminalid, $orderexp_date = 60); /* $arr = explode("&",$url); $encrypt = explode("=",$arr[1]); $data = explode("=",$arr[2]); $code = "<a target='' href=$url>一键支付</a>"; $code.="<br /><span class='red'>".$GLOBALS['lang']['PAY_TOTAL_PRICE'].":".format_price($money)."</span>"; return $code; */ file_put_contents("./log/yjwap_user_ua_" . strftime("%Y%m%d%H%M%S", time()) . ".txt", print_r($user_ua, true)); $pay = array(); $pay['user_ua'] = $user_ua; $pay['user_ip'] = $user_ip; $pay['subject'] = $product_name; $pay['body'] = '会员充值'; $pay['total_fee'] = $money; $pay['total_fee_format'] = format_price($money); $pay['out_trade_no'] = $payment_notice['notice_sn']; $pay['notify_url'] = $url; $pay['partner'] = ''; //$payment_info['config']['alipay_partner'];//合作商户ID $pay['seller'] = ''; //$payment_info['config']['alipay_account'];//账户ID $pay['key'] = ''; //$payment_info['config']['alipay_key'];//支付宝(RSA)公钥 $pay['is_wap'] = 1; // $pay['pay_code'] = 'yjwap'; //,支付宝;mtenpay,财付通;mcod,货到付款 return $pay; }