当前位置: 首页>>代码示例>>PHP>>正文


PHP AlipaySubmit类代码示例

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


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

示例1: 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', '确认');
 }
开发者ID:ping199143,项目名称:1ydb,代码行数:33,代码来源:wapalipay.class.php

示例2: send_goods_confirm_by_platform

	/**
     * 构造确认发货接口
     * @param $para_temp 请求参数数组
     * @return 获取支付宝的返回XML处理结果
     */
	function send_goods_confirm_by_platform($para_temp) {

		//获取支付宝的返回XML处理结果
		$alipaySubmit = new AlipaySubmit();
		$html_text = $alipaySubmit->sendPostInfo($para_temp, $this->alipay_gateway_new, $this->aliapy_config);
		return $html_text;
	}
开发者ID:noikiy,项目名称:mdwp,代码行数:12,代码来源:AlipayNewService.class.php

示例3: 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;
 }
开发者ID:d0oo0b,项目名称:wechatcms,代码行数:60,代码来源:PayAction.class.php

示例4: trade_create_by_buyer

 function trade_create_by_buyer($para_temp)
 {
     $button_name = "确认";
     $alipaySubmit = new AlipaySubmit();
     $html_text = $alipaySubmit->buildForm($para_temp, $this->alipay_gateway_new, "get", $button_name, $this->aliapy_config);
     return $html_text;
 }
开发者ID:keyu199314,项目名称:php,代码行数:7,代码来源:alipay_service.class.php

示例5: 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;
	}
开发者ID:jl9n,项目名称:phpstudy,代码行数:31,代码来源:AliPay即时到账.php

示例6: send

 public function send($trade_no, $logistics_name, $invoice_no)
 {
     require_once "lib/alipay_submit.class.php";
     $alipaySubmit = new AlipaySubmit($this->config);
     $parameter = array("service" => "send_goods_confirm_by_platform", "partner" => trim($this->config['partner']), "trade_no" => $trade_no, "logistics_name" => $logistics_name, "invoice_no" => $invoice_no, "transport_type" => 'EXPRESS', "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
     $html_text = $alipaySubmit->buildRequestHttp($parameter);
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:7,代码来源:AlipayDelivery.php

示例7: 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;
 }
开发者ID:yakrsa,项目名称:football,代码行数:25,代码来源:AlipayReceiveAction.class.php

示例8: 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;
 }
开发者ID:bytrix,项目名称:witkey,代码行数:31,代码来源:AlipayController.php

示例9: _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 '提交成功';
  
  }
开发者ID:8yong8,项目名称:vshop,代码行数:32,代码来源:Alipay.class.php

示例10: get_code

 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;
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:27,代码来源:alipaylogin.php

示例11: send

 /**
  * @brief 开始向接口发送数据
  * @param $data array 订单和配送数据
  */
 public function send($data)
 {
     require_once dirname(__FILE__) . "/lib/alipay_submit.class.php";
     /* if(isset($data['seller_id']) && $data['seller_id'] > 0 ){
     			//获取商户的支付配置信息
     			$sellPay = new IModel("seller_payment");
     			$sellers = $sellPay->getObj("seller_id = ".$data['seller_id']);
     			if(empty($sellers)){
     				return false;
     			}
     		} */
     $alipay_config = array('partner' => Payment::getConfigParam($data['pay_type'], 'M_PartnerId'), 'key' => Payment::getConfigParam($data['pay_type'], 'M_PartnerKey'), 'sign_type' => strtoupper('MD5'), 'input_charset' => strtolower('utf-8'), 'cacert' => getcwd() . '/cacert.pem', 'transport' => 'http');
     //支付宝交易号
     $trade_no = $data['trade_no'];
     //必填
     //物流公司名称
     $logistics_name = $data['freight_type'];
     //必填
     //物流发货单号
     $invoice_no = $data['delivery_code'];
     //物流运输类型 三个值可选:POST(平邮)、EXPRESS(快递)、EMS(EMS)
     $transport_type = 'EXPRESS';
     //构造要请求的参数数组,无需改动
     $parameter = array("service" => "send_goods_confirm_by_platform", "partner" => trim($alipay_config['partner']), "trade_no" => $trade_no, "logistics_name" => $logistics_name, "invoice_no" => $invoice_no, "transport_type" => $transport_type, "_input_charset" => trim(strtolower('utf-8')));
     //建立请求
     $alipaySubmit = new AlipaySubmit($alipay_config);
     $html_text = $alipaySubmit->buildRequestHttp($parameter);
 }
开发者ID:yongge666,项目名称:sunupedu,代码行数:32,代码来源:sendgoods_platform_assure_alipay.php

示例12: outPayForUrl

 public function outPayForUrl($order, $notify_url, $return_url)
 {
     $alipaySubmit = new AlipaySubmit($this->config);
     //支付类型
     $payment_type = "1";
     //卖家支付宝帐户
     $seller_email = $this->config['account'];
     //必填
     //商户订单号
     $out_trade_no = $order['ordersn'];
     //商户网站订单系统中唯一订单号,必填
     //订单名称
     $subject = $order['ordertitle'];
     //必填
     //付款金额
     $total_fee = $order['orderprice'];
     //必填
     //订单描述
     $body = $order['orderdescribe'];
     //商品展示地址
     $show_url = 'index.php?item-app-order&ordersn=' . $order['ordersn'];
     //需以http://开头的完整路径,例如:http://www.xxx.com/myorder.html
     //防钓鱼时间戳
     $anti_phishing_key = "";
     //若要使用请调用类文件submit中的query_timestamp函数
     //客户端的IP地址
     $exter_invoke_ip = "";
     //非局域网的外网IP地址,如:221.0.0.1
     //构造要请求的参数数组,无需改动
     $parameter = array("service" => "trade_create_by_buyer", "partner" => trim($this->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, "logistics_type" => 'EXPRESS', "logistics_fee" => 0, "logistics_payment" => 'SELLER_PAY', "price" => $total_fee, "quantity" => 1, "body" => $body, "show_url" => $show_url, "anti_phishing_key" => $anti_phishing_key, "exter_invoke_ip" => $exter_invoke_ip, "_input_charset" => trim(strtolower($this->config['input_charset'])));
     $url = $alipaySubmit->alipay_gateway_new . $alipaySubmit->buildRequestParaToString($parameter);
     unset($alipaySubmit);
     return $url;
 }
开发者ID:HUST-CA,项目名称:Hustca-Ncre,代码行数:34,代码来源:alipay.cls.php

示例13: 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>';
 }
开发者ID:yakrsa,项目名称:football,代码行数:34,代码来源:AlipaytypeAction.class.php

示例14: 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;
     }
 }
开发者ID:huangkaijin,项目名称:clyy,代码行数:25,代码来源:PayController.class.php

示例15: 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;
}
开发者ID:frankwei98,项目名称:WHMCS_Alipay,代码行数:60,代码来源:alipay.php


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