本文整理汇总了PHP中AlipaySubmit::buildRequestForm方法的典型用法代码示例。如果您正苦于以下问题:PHP AlipaySubmit::buildRequestForm方法的具体用法?PHP AlipaySubmit::buildRequestForm怎么用?PHP AlipaySubmit::buildRequestForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlipaySubmit
的用法示例。
在下文中一共展示了AlipaySubmit::buildRequestForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: alipay_link
function alipay_link($params)
{
#支付宝接口配置
$type = $params['T'];
$alipay_config['input_charset'] = 'utf-8';
$alipay_config['sign_type'] = "MD5";
$alipay_config['transport'] = $params['ssl'] ? "https" : "http";
$alipay_config['partner'] = $params['partnerID'];
$alipay_config['key'] = $params['security_code'];
$alipay_config['seller_email'] = $params['seller_email'];
$debug = $params["debug"];
#系统变量
$invoiceid = $params['invoiceid'];
$description = $params["description"];
$amount = $params['amount'];
# Format: ##.##
$currency = $params['currency'];
# Currency Code
$companyname = $params['companyname'];
$systemurl = $params['systemurl'];
$currency = $params['currency'];
$alipay_config['return_url'] = $systemurl . "/modules/gateways/callback/alipay_return.php";
$alipay_config['notify_url'] = $systemurl . "/modules/gateways/callback/alipay_callback.php";
switch ($type) {
case "1":
$service_name = "create_direct_pay_by_user";
break;
case "2":
$service_name = "create_partner_trade_by_buyer";
break;
case "3":
$service_name = "trade_create_by_buyer";
break;
default:
}
//基本参数
$parameter = array("service" => $service_name, "partner" => trim($alipay_config['partner']), "_input_charset" => trim(strtolower($alipay_config['input_charset'])), "return_url" => trim($alipay_config['return_url']), "sign_type" => trim($alipay_config['sign_type']), "notify_url" => trim($alipay_config['notify_url']));
//业务参数
$parameter["subject"] = "{$companyname} 订单[ {$invoiceid} ]";
$parameter["body"] = $description;
$parameter["out_trade_no"] = $invoiceid;
$parameter["price"] = $amount;
$parameter["quantity"] = "1";
$parameter["payment_type"] = "1";
$parameter["seller_email"] = trim($alipay_config['seller_email']);
if ($type != "1") {
$parameter["logistics_fee"] = "0";
$parameter["logistics_type"] = "EXPRESS";
$parameter["logistics_payment"] = "SELLER_PAY";
}
$img = $systemurl . "/modules/gateways/callback/alipay.png";
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter, "get", "确认");
if ($debug) {
$msg = "订单: {$invoiceid} 生成支付表单 {$html_text}";
logResult($msg);
}
$code = $html_text . "</form><a href='#' onclick=\"document.forms['alipaysubmit'].submit();\"><img src='{$img}' alt='点击使用支付宝支付'> </a>";
return $code;
}
示例2: AliPay
public function AliPay($data){
$alipay_config['partner'] = $this->partner;
$alipay_config['seller_email'] = $this->seller_email;
$alipay_config['key'] = $this->paykey;
$alipay_config['sign_type'] = strtoupper('MD5');//签名方式
$alipay_config['input_charset']= strtolower('utf-8');//字符编码
//$alipay_config['cacert'] = getcwd().'\\cacert.pem';
$alipay_config['transport'] = 'http';
$parameter = array(
"service" => "create_direct_pay_by_user",
"partner" => trim($alipay_config['partner']),
"seller_email" => trim($alipay_config['seller_email']),
"payment_type" => '1',
"notify_url" => $this->notify_url,
"return_url" => $this->return_url,
"out_trade_no" => $this->orderid,
"subject" => $this->subject,
"total_fee" => $this->price,
"body" => $this->message,
"show_url" => $this->show_url,
"anti_phishing_key" => $this->anti_key,
"exter_invoke_ip" => $this->exter_ip,
"_input_charset" => trim(strtolower($alipay_config['input_charset']))
);
//建立请求
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter,"get", $this->waitword);
return $html_text;
}
示例3: _alipayto
public function _alipayto(){
//支付信息
$alipaySubmit = new AlipaySubmit($alipay_config);
//$anti_phishing_key = $alipaySubmit->query_timestamp();
$payment_type = "1";
$exter_invoke_ip = $_SERVER['REMOTE_ADDR'];
$out_trade_no = $row['pay_order_id'];
$parameter = array(
"service" => "create_direct_pay_by_user",
"partner" => trim($alipay_config['partner']),
"payment_type" => $payment_type,
"notify_url" => $notify_url,
"return_url" => $return_url,
"seller_email" => $seller_email,
"out_trade_no" => $out_trade_no,
"subject" => $subject,
"total_fee" => $total_fee,
"body" => $body,
//"show_url" => $show_url,
//"anti_phishing_key" => $anti_phishing_key,
"exter_invoke_ip" => $exter_invoke_ip,
"_input_charset" => trim(strtolower($alipay_config['input_charset']))
);
//var_dump($parameter);exit;
//建立请求
//$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter,"get", "确认");
echo $html_text;
//echo '提交成功';
}
示例4: doalipay
public function doalipay()
{
$recorder = M('Recorder');
$rid = $_GET['rid'];
$map['id'] = $rid;
$map['userid'] = session('userid');
$recinfo = $recorder->where($map)->find();
if ($recinfo) {
//这里我们通过TP的C函数把配置项参数读出,赋给$alipay_config;
$alipay_config = C('alipay_config');
$payment_type = "1";
//支付类型 //必填,不能修改
$notify_url = C('alipay.notify_url');
//服务器异步通知页面路径
$return_url = C('alipay.return_url');
//页面跳转同步通知页面路径
$seller_email = C('alipay.seller_email');
//卖家支付宝帐户必填
$parameter = array("service" => "create_direct_pay_by_user", "partner" => trim($alipay_config['partner']), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $recinfo['order_sn'], "subject" => '我爱换驾共享豆充值', "total_fee" => '0.01', "body" => '共享豆充值', "show_url" => '', "anti_phishing_key" => "", "exter_invoke_ip" => "", "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
$alipaySubmit = new \AlipaySubmit($alipay_config);
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
$html_text = $alipaySubmit->buildRequestForm($parameter, "post", "确认");
echo $html_text;
}
}
示例5: get_code
public function get_code($order)
{
require_once "lib/alipay_submit.class.php";
$notify_url = U("Server/Index/aliguaranteebackn", array("id" => $order['id']), true, true);
$return_url = U("Server/Order/detail", array("id" => $order['id']), true, true);
$payment_type = "1";
$out_trade_no = $order['order_id'];
$subject = $this->ordername;
$price = $order['price'];
$quantity = "1";
$logistics_fee = "0.00";
$logistics_type = "EXPRESS";
$logistics_payment = "SELLER_PAY";
$body = $this->ordername;
$show_url = "";
$receive_name = "";
$receive_address = "";
$receive_zip = "";
$receive_phone = "";
$receive_mobile = "";
$parameter = array("service" => "create_partner_trade_by_buyer", "partner" => trim($this->alipay_config['partner']), "seller_email" => trim($this->alipay_config['seller_email']), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "out_trade_no" => $out_trade_no, "subject" => $subject, "price" => $price, "quantity" => $quantity, "logistics_fee" => $logistics_fee, "logistics_type" => $logistics_type, "logistics_payment" => $logistics_payment, "body" => $body, "show_url" => $show_url, "receive_name" => $receive_name, "receive_address" => $receive_address, "receive_zip" => $receive_zip, "receive_phone" => $receive_phone, "receive_mobile" => $receive_mobile, "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])));
$this->alipay_config['cacert'] = $this->cacert;
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter, "get", "确认");
return $html_text;
}
示例6: buildForm
public function buildForm($request)
{
//构造要请求的参数数组,无需改动
$req_id = date('Ymdhis');
$req_data = '<direct_trade_create_req><notify_url>' . $this->notify_url . '</notify_url><call_back_url>' . $this->call_back_url . '</call_back_url><seller_account_name>' . $this->seller_email . '</seller_account_name><out_trade_no>' . $request->out_trade_no . '</out_trade_no><subject>' . $request->subject . '</subject><total_fee>' . $request->total_fee . '</total_fee><merchant_url>' . $this->merchant_url . '</merchant_url></direct_trade_create_req>';
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($this->partner), "key" => $this->key, 'sec_id' => $this->sign_type, "format" => $this->format, "v" => $this->v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->_input_charset)));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
//URLDECODE返回的信息
$html_text = urldecode($html_text);
//解析远程模拟提交后返回的信息
$para_html_text = $alipaySubmit->parseResponse($html_text);
//获取request_token
$request_token = $para_html_text['request_token'];
/**************************根据授权码token调用交易接口alipay.wap.auth.authAndExecute**************************/
//业务详细
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
//必填
//构造要请求的参数数组,无需改动
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($this->partner), 'sec_id' => $this->sign_type, "format" => $this->format, "v" => $this->v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->_input_charset)));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
return $alipaySubmit->buildRequestForm($parameter, "get", "确认");
}
示例7: alipayapi
public function alipayapi()
{
// $username = Auth::user()->username;
// $password = Input::get('password');
// $userPassword = Auth::user()->password;
// if (! Auth::validate(array('username'=>$username, 'password'=>$password))) {
// return Redirect::back()
// ->with('message', 'wrong-credential');
// }
// dd(public_path());
// require_once("alipay.config.php");
// require_once("lib/alipay_submit.class.php");
require_once public_path() . "/alipay/alipay.config.php";
require_once public_path() . "/alipay/lib/alipay_submit.class.php";
/**************************请求参数**************************/
//商户订单号,商户网站订单系统中唯一订单号,必填
$out_trade_no = $_POST['WIDout_trade_no'];
//订单名称,必填
$subject = $_POST['WIDsubject'];
//付款金额,必填
$total_fee = $_POST['WIDtotal_fee'];
//商品描述,可空
$body = $_POST['WIDbody'];
/************************************************************/
//构造要请求的参数数组,无需改动
$parameter = array("service" => $alipay_config['service'], "partner" => $alipay_config['partner'], "seller_id" => $alipay_config['seller_id'], "payment_type" => $alipay_config['payment_type'], "notify_url" => $alipay_config['notify_url'], "return_url" => $alipay_config['return_url'], "anti_phishing_key" => $alipay_config['anti_phishing_key'], "exter_invoke_ip" => $alipay_config['exter_invoke_ip'], "out_trade_no" => $out_trade_no, "subject" => $subject, "total_fee" => $total_fee, "body" => $body, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter, "get", "确认");
echo $html_text;
}
示例8: recharge
public function recharge()
{
$amount = intval($this->_post('amount'));
if (!$amount) {
$amount = intval($this->_get('amount'));
}
//
$buyDiscount = 0;
if (isset($_GET['discountpriceid'])) {
$thisPrice = M('Agent_price')->where(array('id' => intval($_GET['discountpriceid'])))->find();
$buyDiscount = 1;
$amount = $thisPrice['price'];
}
if (!$amount) {
$this->error('请填写金额');
}
import("@.ORG.Alipay.AlipaySubmit");
//支付类型
$payment_type = "1";
//必填,不能修改
//服务器异步通知页面路径
$notify_url = C('site_url') . U('Agent/Pay/notify');
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$return_url = C('site_url') . U('Agent/Pay/return_url', array('discountpriceid' => intval($_GET['discountpriceid'])));
//需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
//卖家支付宝帐户
$seller_email = trim(C('alipay_name'));
//商户订单号
$out_trade_no = $this->thisAgent['id'] . '_' . time();
//商户网站订单系统中唯一订单号,必填
//订单名称
if ($buyDiscount) {
$subject = '购买优惠套餐' . $thisPrice['name'] . '(ID:' . $thisPrice['id'] . ')';
} else {
$subject = '充值' . $amount . '元';
}
//必填
//付款金额
$total_fee = $amount;
$body = $subject;
//商品展示地址
$show_url = C('site_url') . U('Agent/Basic/expenseRecords');
//需以http://开头的完整路径,例如:http://www.xxx.com/myorder.html
//防钓鱼时间戳
$anti_phishing_key = "";
//若要使用请调用类文件submit中的query_timestamp函数
//客户端的IP地址
$exter_invoke_ip = "";
//非局域网的外网IP地址,如:221.0.0.1
$body = $subject;
$data = M('Agent_expenserecords')->data(array('agentid' => $this->thisAgent['id'], 'des' => $subject, 'time' => time(), 'orderid' => $out_trade_no, 'amount' => $total_fee))->add();
$show_url = rtrim(C('site_url'), '/');
//构造要请求的参数数组,无需改动
$parameter = array("service" => "create_direct_pay_by_user", "partner" => trim(C('alipay_pid')), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "total_fee" => $total_fee, "body" => $body, "show_url" => $show_url, "anti_phishing_key" => $anti_phishing_key, "exter_invoke_ip" => $exter_invoke_ip, "_input_charset" => trim(strtolower('utf-8')));
//建立请求
$alipaySubmit = new AlipaySubmit($this->setconfig());
$html_text = $alipaySubmit->buildRequestForm($parameter, "get", "确认支付");
echo $html_text;
}
示例9: pay
public function pay()
{
$price = $_GET['price'];
$orderName = $_GET['orderName'];
if (!$orderName) {
$orderName = microtime();
}
$orderid = $_GET['orderid'];
if (!$orderid) {
$orderid = $_GET['single_orderid'];
}
$alipayConfig = $this->alipayConfig;
if (!$price) {
exit('必须有价格才能支付');
}
import("@.ORG.Alipay.AlipaySubmit");
$payment_type = "1";
$notify_url = C('site_url') . '/index.php?g=Wap&m=Alipay&a=notify_url';
$return_url = C('site_url') . '/index.php?g=Wap&m=Alipay&a=return_url';
$seller_email = trim($alipayConfig['name']);
$out_trade_no = $orderid;
$subject = $orderName;
$total_fee = floatval($price);
$body = $orderName;
$show_url = C('site_url') . U('Home/Index/price');
$anti_phishing_key = "";
$exter_invoke_ip = "";
$body = $subject;
$show_url = rtrim(C('site_url'), '/');
$parameter = array("service" => "create_direct_pay_by_user", "partner" => trim($alipayConfig['pid']), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "total_fee" => $total_fee, "body" => $body, "show_url" => $show_url, "anti_phishing_key" => $anti_phishing_key, "exter_invoke_ip" => $exter_invoke_ip, "_input_charset" => trim(strtolower('utf-8')));
$alipaySubmit = new AlipaySubmit($this->setconfig());
$html_text = $alipaySubmit->buildRequestForm($parameter, "get", "进行支付");
echo '正在跳转到支付宝进行支付...<div style="display:none">' . $html_text . '</div>';
}
示例10: submit
public function submit()
{
//请求业务参数详细
$req_data = '<direct_trade_create_req><notify_url>' . $this->notify_url . '</notify_url><call_back_url>' . $this->call_back_url . '</call_back_url><seller_account_name>' . $this->seller_email . '</seller_account_name><out_trade_no>' . $this->out_trade_no . '</out_trade_no><subject>' . $this->subject . '</subject><total_fee>' . $this->total_fee . '</total_fee></direct_trade_create_req>';
//必填
//构造要请求的参数数组,无需改动
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($this->alipay_config['partner']), "sec_id" => trim($this->alipay_config['sign_type']), "format" => $this->format, "v" => $this->v, "req_id" => $this->req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestHttp($para_token);
//URLDECODE返回的信息
$html_text = urldecode($html_text);
//解析远程模拟提交后返回的信息
$para_html_text = $alipaySubmit->parseResponse($html_text);
//获取request_token
$request_token = $para_html_text['request_token'];
/**************************根据授权码token调用交易接口alipay.wap.auth.authAndExecute**************************/
//业务详细
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
//必填
//构造要请求的参数数组,无需改动
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($this->alipay_config['partner']), "sec_id" => trim($this->alipay_config['sign_type']), "format" => $this->format, "v" => $this->v, "req_id" => $this->req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($this->alipay_config['input_charset'])));
//建立请求
$alipaySubmit = new AlipaySubmit($this->alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter, 'get', '正在跳转支付页面...');
return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>支付宝即时到账交易接口接口</title>
</head>' . $html_text . '
</body>
</html>';
}
示例11: post
public function post()
{
$gid = $this->_post('gid', 'trim');
$price = $this->_post('price', 'intval');
if ($price == false || $this->_post('uname') == false) {
$this->error('价格和用户名必须填写');
}
if ($gid != $this->_session('gid') && $this->_session('viptime') > time()) {
$this->error('如需升级请联系客服!');
}
import("@.ORG.Alipay.AlipaySubmit");
$faceType = trim(C('faceType'));
//**充值配置***//
//支付类型
$payment_type = "1";
//必填,不能修改
//服务器异步通知页面路径
$notify_url = C('site_url') . U('User/Alipay/notify');
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$return_url = C('site_url') . U('User/Alipay/return_url');
//需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
//卖家支付宝帐户
$seller_email = trim(C('alipay_name'));
//商户订单号
$out_trade_no = session('uname') . time();
//订单名称
$subject = '充值vip' . $this->_post('group') . '会员' . $this->_post('num') . '个月';
//付款金额
$total_fee = (int) $_POST['price'];
//商品数量
$quantity = "1";
$logistics_fee = "0.00";
//必填,即运费
//物流类型
$logistics_type = "EXPRESS";
//必填,三个值可选:EXPRESS(快递)、POST(平邮)、EMS(EMS)
//物流支付方式
$logistics_payment = "SELLER_PAY";
//必填,两个值可选:SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
//订单描述
$body = $subject;
$data = M('Indent')->data(array('uid' => session('uid'), 'title' => $subject, 'uname' => $this->_post('uname'), 'gid' => $gid, 'create_time' => time(), 'indent_id' => $out_trade_no, 'price' => $total_fee, 'quantity' => $this->_post('num')))->add();
$show_url = rtrim(C('site_url'), '/');
///***公用充值配置结束***//
if ($faceType == '0') {
//构造要请求的参数数组,无需改动
$parameter = array("service" => "create_partner_trade_by_buyer", "partner" => trim(C('alipay_pid')), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "price" => $total_fee, "quantity" => $quantity, "logistics_fee" => $logistics_fee, "logistics_type" => $logistics_type, "logistics_payment" => $logistics_payment, "body" => $body, "show_url" => $show_url, "_input_charset" => trim(strtolower(strtolower('utf-8'))));
} elseif ($faceType == '1') {
//构造要请求的参数数组,无需改动
$parameter = array("service" => "create_direct_pay_by_user", "partner" => trim(C('alipay_pid')), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "price" => $total_fee, "quantity" => $quantity, "logistics_fee" => $logistics_fee, "logistics_type" => $logistics_type, "logistics_payment" => $logistics_payment, "body" => $body, "show_url" => $show_url, "_input_charset" => trim(strtolower(strtolower('utf-8'))));
} elseif ($faceType == '2') {
//构造要请求的参数数组,无需改动
$parameter = array("service" => "trade_create_by_buyer", "partner" => trim(C('alipay_pid')), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "price" => $total_fee, "quantity" => $quantity, "logistics_fee" => $logistics_fee, "logistics_type" => $logistics_type, "logistics_payment" => $logistics_payment, "body" => $body, "show_url" => $show_url, "_input_charset" => trim(strtolower(strtolower('utf-8'))));
}
//建立请求
$alipaySubmit = new AlipaySubmit($this->setconfig());
$html_text = $alipaySubmit->buildRequestForm($parameter, "get", "确认");
echo $html_text;
}
示例12: post
public function post()
{
if ($this->_get('price') == false || $this->_get('uname') == false) {
$this->error('价格和用户名必须填写');
}
import("@.ORG.Alipay.AlipaySubmit");
$payment_type = "1";
$notify_url = C('site_url') . U('User/Alipay/notify');
$return_url = C('site_url') . U('User/Alipay/return_url', array('uid' => intval($_GET['uid'])));
$seller_email = trim(C('alipay_name'));
$out_trade_no = $this->_get('uid') . '_' . time();
$subject = '充值vip' . $this->_get('group') . '会员' . $this->_get('num') . '个月';
$total_fee = (int) $this->_get('price');
$body = 'vip高级会员服务费';
$show_url = C('site_url') . U('Home/Index/price');
$anti_phishing_key = "";
$exter_invoke_ip = "";
$body = $subject;
$data = M('Indent')->data(array('uid' => intval($_GET['uid']), 'month' => intval($this->_get('num')), 'title' => $subject, 'uname' => $this->_get('uname'), 'gid' => $this->_get('groupid'), 'create_time' => time(), 'indent_id' => $out_trade_no, 'price' => $total_fee))->add();
$show_url = rtrim(C('site_url'), '/');
$parameter = array("service" => "create_direct_pay_by_user", "partner" => trim(C('alipay_pid')), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "total_fee" => $total_fee, "body" => $body, "show_url" => $show_url, "anti_phishing_key" => $anti_phishing_key, "exter_invoke_ip" => $exter_invoke_ip, "_input_charset" => trim(strtolower('utf-8')));
$alipaySubmit = new AlipaySubmit($this->setconfig());
$html_text = $alipaySubmit->buildRequestForm($parameter, "get", "确认");
echo $html_text;
}
示例13: array
function get_code($ologin) {
$aliapy_config['partner'] = $ologin['alipaylogin_id'];
$aliapy_config['key'] = $ologin['alipaylogin_key'];
$aliapy_config['return_url'] = ologin::url(basename(__FILE__,'.php'));
$aliapy_config['sign_type'] = 'MD5';
$aliapy_config['input_charset']= 'utf-8';
$aliapy_config['transport'] = 'http';
//require_once("alipayauth/alipay_service.class.php");
require_once("alipayauth/alipay_submit.class.php");
$parameter = array(
"service" => "alipay.auth.authorize",
"target_service" => 'user.auth.quick.login',
"partner" => trim($aliapy_config['partner']),
"_input_charset" => trim(strtolower($aliapy_config['input_charset'])),
"return_url" => trim($aliapy_config['return_url']),
"anti_phishing_key" => '',
"exter_invoke_ip" => '',
);
ini_set("display_errors","On");
//var_dump($aliapy_config);exit;
$alipayService = new AlipaySubmit($aliapy_config);
$login_url = $alipayService->buildRequestForm($parameter,"get", "");
//file_put_contents('logs.txt',$login_url);exit;
//var_dump($login_url);exit;
echo $login_url;exit;
return $login_url;
}
示例14: pay
public function pay($runValidation = true)
{
if ($runValidation && !$this->validate()) {
return false;
}
if ($this->_order->status !== Order::STATUS_UNPAID) {
return false;
}
try {
switch ($this->platform) {
case self::PLATFORM_ALIPAY:
require_once Yii::getAlias('@vendor') . '/payment/alipay/alipay.config.php';
require_once Yii::getAlias('@vendor') . '/payment/alipay/lib/alipay_submit.class.php';
$parameter = ['service' => 'create_direct_pay_by_user', 'partner' => trim($alipay_config['partner']), 'seller_email' => trim($alipay_config['seller_email']), 'payment_type' => '1', 'notify_url' => Url::to(['/payment/alipay-order-notify'], true), 'return_url' => Url::to(['/payment/alipay-order-return'], true), 'out_trade_no' => $this->_order->order_sn, 'subject' => '订单支付', 'total_fee' => $this->_order->real_fee, 'body' => '笑e购(xiaoego.com)订单,订单号:' . $this->_order->order_sn, 'show_url' => Url::to(['/order/detail', 'order' => $this->_order->order_sn], true), 'anti_phishing_key' => '', 'exter_invoke_ip' => '', '_input_charset' => trim(strtolower($alipay_config['input_charset']))];
//建立请求
$alipaySubmit = new \AlipaySubmit($alipay_config);
$htmlText = $alipaySubmit->buildRequestForm($parameter, 'post', '');
break;
default:
throw new InvalidValueException();
}
return $htmlText;
} catch (\Exception $e) {
return false;
}
}
示例15: config
public function config($config = null)
{
$format = "xml";
$req_id = date('Ymdhis');
$merchant_url = "";
$notify_url = $config['NotifyUrl'];
$return_url = $config['ReturnUrl'];
$seller_email = $config['pay_type_data']['user']['val'];
$out_trade_no = $config['code'];
$subject = $config['title'];
$total_fee = $config['money'];
$wapalipay_config_id = trim($config['id']);
$wapalipay_config_key = trim($config['key']);
$wapalipay_config_input_charset = strtolower('utf-8');
$wapalipay_config_sign_type = strtoupper('MD5');
$wapalipay_config_input_charset = strtolower('utf-8');
$wapalipay_config_cacert = dirname(__FILE__) . DIRECTORY_SEPARATOR . "wapalipay" . DIRECTORY_SEPARATOR . "cacert.pem";
$wapalipay_config_private_key_path = '.' . DIRECTORY_SEPARATOR . 'wapalipay' . DIRECTORY_SEPARATOR . 'rsa_private_key.pem';
$wapalipay_config_ali_public_key_path = '.' . DIRECTORY_SEPARATOR . 'wapalipay' . DIRECTORY_SEPARATOR . 'alipay_public_key.pem';
$wapalipay_config_transport = 'http';
$wapalipay_config = array("partner" => $wapalipay_config_id, "key" => $wapalipay_config_key, "private_key_path" => $wapalipay_config_private_key_path, "ali_public_key_path" => $wapalipay_config_ali_public_key_path, "sign_type" => $wapalipay_config_sign_type, "input_charset" => $wapalipay_config_input_charset, "cacert" => $wapalipay_config_cacert, "transport" => $wapalipay_config_transport);
$req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $return_url . '</call_back_url><seller_account_name>' . $seller_email . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
$para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($config['id']), "sec_id" => $wapalipay_config_sign_type, "format" => $format, "v" => "2.0", "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => $wapalipay_config_input_charset);
$wapalipaySubmit = new AlipaySubmit($wapalipay_config);
$html_text = $wapalipaySubmit->buildRequestHttp($para_token);
$html_text = urldecode($html_text);
$para_html_text = $wapalipaySubmit->parseResponse($html_text);
$request_token = $para_html_text['request_token'];
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
$parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($config['id']), "sec_id" => $wapalipay_config_sign_type, "format" => $format, "v" => "2.0", "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => $wapalipay_config_input_charset);
$wapalipaySubmit = new AlipaySubmit($wapalipay_config);
$this->url = $wapalipaySubmit->buildRequestForm($parameter, 'get', '确认');
}