<?php
require_once("alipay.config.php");
require_once("lib/alipay_service.class.php");
include_once("../../../lib/cs_conn.php");
include_once("../../../lib/cs_common.php");
/**************************请求参数**************************/

//必填参数//
$out_trade_no = CS_Request("dingdan");		//请与贵网站订单系统中的唯一订单号匹配
$subject      = CS_Request("remark");	//订单名称，显示在支付宝收银台里的“商品名称”里，显示在支付宝的交易管理的“商品名称”的列表里。
$body         = CS_Request("remark");	//订单描述、订单详细、订单备注，显示在支付宝收银台里的“商品描述”里
$total_fee    = CS_Request("rmb");	//订单总金额，显示在支付宝收银台里的“应付总额”里

$paymethod    = 'directPay';

$defaultbank  = '';

$anti_phishing_key  = '';

$exter_invoke_ip = '';

$show_url = 'http://www.xxx.com/order/myorder.php';

$extra_common_param = '';

$royalty_type		= "";			//提成类型，该值为固定值：10，不需要修改
$royalty_parameters	= "";

/************************************************************/

//构造要请求的参数数组
$parameter = array(
		"service"			=> "create_direct_pay_by_user",
		"payment_type"		=> "1",
		
		"partner"			=> trim($aliapy_config['partner']),
		"_input_charset"	=> trim(strtolower($aliapy_config['input_charset'])),
        "seller_email"		=> trim($aliapy_config['seller_email']),
        "return_url"		=> trim($aliapy_config['return_url']),
        "notify_url"		=> trim($aliapy_config['notify_url']),
		
		"out_trade_no"		=> $out_trade_no,
		"subject"			=> $subject,
		"body"				=> $body,
		"total_fee"			=> $total_fee,
		
		"paymethod"			=> $paymethod,
		"defaultbank"		=> $defaultbank,
		
		"anti_phishing_key"	=> $anti_phishing_key,
		"exter_invoke_ip"	=> $exter_invoke_ip,
		
		"show_url"			=> $show_url,
		"extra_common_param"=> $extra_common_param,
		
		"royalty_type"		=> $royalty_type,
		"royalty_parameters"=> $royalty_parameters
);

//构造即时到帐接口
$alipayService = new AlipayService($aliapy_config);
$html_text = $alipayService->create_direct_pay_by_user($parameter);
echo $html_text;

?>
