 
   			 <?php   
        $paypalurl =   "https://www.paypal.com/cgi-bin/webscr";
 
        $tax_total = $cart["tax"];
        $discount_total = $cart["discount"];
		$post_variables = Array(
		"cmd" => "_xclick",
		"upload" => "1",
		"business" => $params->get("business_id"),
		"receiver_email" => $params->get("business_id"),
		"item_name" =>  $order->order_id,
		"order_id" => $order->order_id,
		"invoice" =>  $order->order_number,
		"amount" =>  $order->order_total, 
		"return" => $url ."index.php?option=com_redshop&view=order_detail&oid=".$order->order_id,
		"notify_url" => $url ."administrator/components/com_redshop/helpers/payments/paypal/notify.php",
		"cancel_return" => $url ."index.php",
		"undefined_quantity" => "0",
		"test_ipn" => $params->get("is_test"),
		"pal" => "NRUBJXESJTY24",
		"no_shipping" => "1",
		"no_note" => "1"
	); 

	if( $task == "checkoutfinal" ) {
		$query_string = "?";
		foreach( $post_variables as $name => $value ) {
		$query_string .= $name ."=" . urlencode($value) ."&";
	}

		$mainframe->redirect( $paypalurl . $query_string );
	} else {	

		echo "<form action='$paypalurl' method='post' target='_blank'>";
		echo "<input type='image' name='submit' src='http://images.paypal.com/images/x-click-but6.gif' border='0' alt='Make payments with PayPal, it is fast, free, and secure!' />";

	foreach( $post_variables as $name => $value ) {
		echo "<input type='hidden' name='$name' value='$value' />";
	} 
		echo "</form>";
	}
?>