public function get_payment_code($payment_notice_id) { $upop_evn = $this->upop_evn; $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $order_sn = $GLOBALS['db']->getOne("select order_sn 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']); // 商户名称 quickpay_conf::$pay_params['merAbbr'] = $payment_info['config']['upop_merAbbr']; foreach (Upop_payment::$api_url[$upop_evn] as $key => $value) { quickpay_conf::${$key} = $value; } if ($upop_evn == '2') { quickpay_conf::$security_key = $payment_info['config']['upop_security_key']; quickpay_conf::$pay_params['merId'] = $payment_info['config']['upop_account']; } else { if ($upop_evn == '1') { quickpay_conf::$security_key = $payment_info['config']['upop_security_key_pm']; quickpay_conf::$pay_params['merId'] = $payment_info['config']['upop_account_pm']; } else { if ($upop_evn == '0') { quickpay_conf::$security_key = $payment_info['config']['upop_security_key']; quickpay_conf::$pay_params['merId'] = $payment_info['config']['upop_account']; } } } $frontEndUrl = SITE_DOMAIN . APP_ROOT . '/callback/payment/upop_response.php'; $backEndUrl = SITE_DOMAIN . APP_ROOT . '/callback/payment/upop_notify.php'; mt_srand(quickpay_service::make_seed()); $param = array(); $param['transType'] = quickpay_conf::CONSUME; // 交易类型,CONSUME or PRE_AUTH $param['orderAmount'] = $money * 100; // 交易金额 转化为分 $param['orderNumber'] = $payment_notice['notice_sn']; // 订单号,必须唯一 $param['orderTime'] = to_date(NOW_TIME, 'YmdHis'); // 交易时间, YYYYmmhhddHHMMSS $param['orderCurrency'] = quickpay_conf::CURRENCY_CNY; //交易币种,CURRENCY_CNY=>人民币 $param['customerIp'] = $_SERVER['REMOTE_ADDR']; // 用户IP $param['frontEndUrl'] = $frontEndUrl; // 前台回调URL $param['backEndUrl'] = $frontEndUrl; // 后台回调URL /* 可填空字段 $param['commodityUrl'] = "http://www.example.com/product?name=商品"; //商品URL $param['commodityName'] = '商品名称'; //商品名称 $param['commodityUnitPrice'] = 11000; //商品单价 $param['commodityQuantity'] = 1; //商品数量 */ $button = "<button class='ui-button paybutton' rel='blue' type='submit'>去网银在线支付</button>"; $pay_service = new quickpay_service($param, quickpay_conf::FRONT_PAY); $html = $pay_service->create_html($button); return $html; }
quickpay_conf::$pay_params['merAbbr'] = $cfg_yinlian_mername; //商户名称 $param['transType'] = quickpay_conf::CONSUME; //交易类型,CONSUME or PRE_AUTH $param['orderAmount'] = $orderAmount; //交易金额 $param['orderNumber'] = $orderNumber; //订单号,必须唯一 $param['orderTime'] = date('YmdHis'); //交易时间, YYYYmmhhddHHMMSS $param['orderCurrency'] = quickpay_conf::CURRENCY_CNY; //交易币种,CURRENCY_CNY=>人民币 $param['customerIp'] = $_SERVER['REMOTE_ADDR']; //用户IP $param['frontEndUrl'] = $GLOBALS['cfg_basehost'] . "/yinlian/front_notify.php"; //前台回调URL $param['backEndUrl'] = $GLOBALS['cfg_basehost'] . "/yinlian/back_notify.php"; //后台回调URL /* 可填空字段 $param['commodityUrl'] = "http://www.example.com/product?name=商品"; //商品URL $param['commodityName'] = '商品名称'; //商品名称 $param['commodityUnitPrice'] = 11000; //商品单价 $param['commodityQuantity'] = 1; //商品数量 //*/ //其余可填空的参数可以不填写 $pay_service = new quickpay_service($param, quickpay_conf::FRONT_PAY); $html = $pay_service->create_html(); header("Content-Type: text/html; charset=" . quickpay_conf::$pay_params['charset']); //print_r($pay_service); echo $html; //自动post表单