<?php
require_once("alipay/alipay_submit.class.php");
//
$alipay_config['partner']		= $alipay_key;
$alipay_config['key']			= $alipay_pid;
$alipay_config['sign_type']    = strtoupper('MD5');
$alipay_config['input_charset']= strtolower('utf-8');
$alipay_config['cacert']    = getcwd().'\\cacert.pem';
$alipay_config['transport']    = 'http';
        $payment_type = "1";
        $notify_url = "http://cps123.114.acd8.com/notify_url.php";
        $return_url = "http://cps123.114.acd8.com/return_url.php";
        $seller_email = $order_emall;
        $out_trade_no = $order_no;
        $subject = $order_name;
if($alipay_type==2){
        $total_fee = $order_price;
        $body = $_POST['WIDbody'];
        $show_url = $_POST['WIDshow_url'];
        $anti_phishing_key = "";
        $exter_invoke_ip = "";
$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']))
);
}
if($alipay_type==1){
        $price = $order_price;
        $quantity = "1";
        $logistics_fee = "0.00";
        $logistics_type = "EXPRESS";
        $logistics_payment = "SELLER_PAY";
        $body = $_POST['WIDbody'];
        $show_url = $_POST['WIDshow_url'];
        $receive_name = $_POST['WIDreceive_name'];
        $receive_address = $_POST['WIDreceive_address'];
        $receive_zip = $_POST['WIDreceive_zip'];
        $receive_phone = $_POST['WIDreceive_phone'];
        $receive_mobile = $_POST['WIDreceive_mobile'];
$parameter = array(
		"service" => "trade_create_by_buyer",
		"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,
		"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($alipay_config['input_charset']))
);
}
//建立请求
$alipaySubmit = new AlipaySubmit($alipay_config);
$html_text = $alipaySubmit->buildRequestForm($parameter,"get", "确认");
echo $html_text;

?>
