<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom Shopping Cart: Paypal to Authorize.net in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/76131#M47537</link>
    <description>&lt;P&gt;Thanks for sharing.&lt;/P&gt;</description>
    <pubDate>Tue, 04 May 2021 03:52:25 GMT</pubDate>
    <dc:creator>feveralburyau</dc:creator>
    <dc:date>2021-05-04T03:52:25Z</dc:date>
    <item>
      <title>Custom Shopping Cart: Paypal to Authorize.net</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/31816#M16565</link>
      <description>&lt;P&gt;Hello all, &amp;nbsp;ive built a dynamically rendering custom cart for use with paypal but now need to convert if for use with authorize.net. &amp;nbsp;All the information is gathered into one form but Im having trouble itemizing and sending all information (item_id, description, price, quantity, total) for multiple products to the payment gateway using SIM. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;paypal code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php 
// Render Cart for View
$cartOutput = "";
$cartTotal = "";
$pp_checkout_btn = '';
$product_id_array = '';
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) &amp;lt; 1) {
	$cartOutput = "&amp;lt;h2 align='center'&amp;gt;Your Shopping Cart is Empty&amp;lt;/h2&amp;gt;";
} else {
	//Start PayPal Checkout Button
	$pp_checkout_btn .= '&amp;lt;form action="&lt;A href="https://www.paypal.com/cgi-bin/webscr" target="_blank"&gt;https://www.paypal.com/cgi-bin/webscr&lt;/A&gt;" method="post"&amp;gt;
	&amp;lt;input type="hidden" name="cmd" value="_cart"&amp;gt;
	&amp;lt;input type="hidden" name="upload" value="1"&amp;gt;
	&amp;lt;input type="hidden" name="business" value="name@example.com"&amp;gt;';
	//Start the For Each Loop
	$i = 0;
	foreach ($_SESSION["cart_array"] as $each_item) {
		
		$item_id = $each_item['item_id'];
		$sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");
		while ($row = mysql_fetch_array($sql)) {
			$product_name = $row["product_name"];
			$price = $row["price"];
			
		}
		$subtotal = $price * $each_item['quantity'];
		$cartTotal = $subtotal + $cartTotal;
		
		setlocale(LC_MONETARY, "en_US");
		$subtotal = money_format("%10.2n", $subtotal);
		
		// Dynamic Checkout Btn Assembly
		$x = $i + 1;
		$pp_checkout_btn .= '&amp;lt;input type="hidden" name="item_name_' . $x . '" value="' . $product_name . '"&amp;gt;
		&amp;lt;input type="hidden" name="amount_' . $x . '" value="' . $price . '"&amp;gt;
		&amp;lt;input type="hidden" name="quantity_' . $x . '" value="' . $each_item['quantity'] . '"&amp;gt; ';
		
		// Create the product array variable
		$product_id_array .= "$item_id-" .$each_item['quantity'].",";
		
		// Dynamic Table Row Assembly
		$cartOutput .= '&amp;lt;tr&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;&amp;lt;img src="../inventory_images/' . $item_id . '.jpg" width="100" height="66" alt="' . $product_name . '" longdesc="../inventory_images/' . $item_id . '.jpg" /&amp;gt;&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;' . $product_name . '&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;$' . $price . '&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;&amp;lt;form action="Shopping_Cart.php" method="post"&amp;gt;
		&amp;lt;input name="quantity" type="text" value="' . $each_item['quantity'] . '" size="1" maxlength="2" /&amp;gt;
		&amp;lt;input name="adjustBtn' . $item_id . '" type="submit" value="Update"/&amp;gt;
		&amp;lt;input name="item_to_adjust" type="hidden" value="' . $item_id . '" /&amp;gt;
		&amp;lt;/form&amp;gt;&amp;lt;/td&amp;gt;';
		//$cartOutput .= '&amp;lt;td&amp;gt;' . $each_item['quantity'] . '&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;' . $subtotal . '&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;&amp;lt;form action="Shopping_Cart.php" method="post"&amp;gt;
		&amp;lt;input name="deleteBtn' . $item_id . '" type="submit" value="X"/&amp;gt;
		&amp;lt;input name="index_to_remove" type="hidden" value="' . $i . '" /&amp;gt;
		&amp;lt;/form&amp;gt;&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;/tr&amp;gt;';
		$i++;
	}
	setlocale(LC_MONETARY, "en_US");
	$cartTotal = money_format("%10.2n", $cartTotal);
	$cartTotal = "Cart Total: " .$cartTotal;
	// Finish the PayPal Checkout Button
	$pp_checkout_btn .= '&amp;lt;input type="hidden" name="custom" value="' . $product_id_array . '"&amp;gt;
						 &amp;lt;input type="hidden" name="notify_url" value="&lt;A href="https://www.website/my_ipn.php" target="_blank"&gt;https://www.website/my_ipn.php&lt;/A&gt;"&amp;gt;
						 &amp;lt;input type="hidden" name="return" value="&lt;A href="https://www.website/checkout_complete.php" target="_blank"&gt;https://www.website/checkout_complete.php&lt;/A&gt;"&amp;gt;
						 &amp;lt;input type="hidden" name="rm" value="2"&amp;gt;
						 &amp;lt;input type="hidden" name="cbt" value="Return to Store"&amp;gt;
						 &amp;lt;input type="hidden" name="cancel_return" value="&lt;A href="https://www.website/paypal_cancel.php" target="_blank"&gt;https://www.website/paypal_cancel.php&lt;/A&gt;"&amp;gt;
						 &amp;lt;input type="hidden" name="lc" value="US"&amp;gt;
						 &amp;lt;input type="hidden" name="currency_code" value="USD"&amp;gt;
						 &amp;lt;input type="image" src="&lt;A href="http://www.website/CheckOutBtn.gif" target="_blank"&gt;http://www.website/CheckOutBtn.gif&lt;/A&gt;" height="22px" width="110px" name="submit"&amp;gt;';

}
?&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;modified code in progress: (its a mess, iknow!)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php&lt;BR /&gt;require_once "../anet_php_sdk/AuthorizeNet.php";
// Render Cart for View
$loginID = "1234567";
$transactionKey = "abcdefgh";
$amount = "";
$description = "";
$url = "&lt;A href="https://secure.authorize.net/gateway/transact.dll" target="_blank"&gt;https://secure.authorize.net/gateway/transact.dll&lt;/A&gt;";

if (array_key_exists("amount" ,$_REQUEST))
	{ $amount = $_REQUEST["amount"]; }
if (array_key_exists("amount" ,$_REQUEST))
	{ $description = $_REQUEST["description"]; }

$invoice = date(YmdHis);
$sequence = rand(1, 1000);
$timeStamp = time();

if( phpversion() &amp;gt;= '5.1.2')
	{ $fingerprint = hash_hmac("md5", $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey); }
	else
	{ $fingerprint = bin2hex(mhash(MHASH_MD5, $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey)); }

$cartOutput = "";
$cartTotal = "";
$pp_checkout_btn = '';
$product_id_array = '';
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) &amp;lt; 1) {
	$cartOutput = "&amp;lt;h2 align='center'&amp;gt;Your Shopping Cart is Empty&amp;lt;/h2&amp;gt;";
} else {
	//Start PayPal Checkout Button****
	$pp_checkout_btn .= '&amp;lt;form action="' . $url . '" method="post"&amp;gt;
	&amp;lt;input type="hidden" name="x_login" value="' . $loginID . '"&amp;gt;
	&amp;lt;input type="hidden" name="upload" value="1"&amp;gt;';
	//Start the For Each Loop
	
	$i = 0;
	foreach ($_SESSION["cart_array"] as $each_item) {
		
		$item_id = $each_item['item_id'];
		$sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");
		while ($row = mysql_fetch_array($sql)) {
			$product_name = $row["product_name"];
			$price = $row["price"];
			
		}
		$subtotal = $price * $each_item['quantity'];
		$cartTotal = $subtotal + $cartTotal;
		
		setlocale(LC_MONETARY, "en_US");
		$subtotal = money_format("%10.2n", $subtotal);
		
		// Dynamic Checkout Btn Assembly****
		$x = $i + 1;
		$pp_checkout_btn .= '&amp;lt;input type="hidden" name="item_name_' . $x . '" value="' . $product_name . '"&amp;gt;
		&amp;lt;input type="hidden" name="amount_' . $x . '" value="' . $price . '"&amp;gt;
		&amp;lt;input type="hidden" name="quantity_' . $x . '" value="' . $each_item['quantity'] . '"&amp;gt; 
		
		&amp;lt;input type="hidden" name="x_amount" value="' . $amount . '"&amp;gt;
		&amp;lt;input type="hidden" name="x_description" value="' . $description . '"&amp;gt;
		&amp;lt;input type="hidden" name="x_invoice_num" value="' . $invoice . '"&amp;gt;
		&amp;lt;input type="hidden" name="x_fp_sequence" value="' . $sequence . '"&amp;gt;
		&amp;lt;input type="hidden" name="x_fp_timestamp" value="' . $timeStamp . '"&amp;gt;
		&amp;lt;input type="hidden" name="x_fp_hash" value="' . $fingerprint . '"&amp;gt;
		&amp;lt;input type="hidden" name="x_show_form" value="PAYMENT_FORM"&amp;gt;';
		
		// Create the product array variable
		$product_id_array .= "$item_id-" .$each_item['quantity'].",";
		
		// Dynamic Table Row Assembly
		$cartOutput .= '&amp;lt;tr&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;&amp;lt;img src="..website/inventory_images/' . $item_id . '.jpg" width="100" height="66" alt="' . $product_name . '" longdesc="..website/inventory_images/' . $item_id . '.jpg" /&amp;gt;&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;' . $product_name . '&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;$' . $price . '&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;&amp;lt;form action="Shopping_Cart.php" method="post"&amp;gt;
		&amp;lt;input name="quantity" type="text" value="' . $each_item['quantity'] . '" size="1" maxlength="2" /&amp;gt;
		&amp;lt;input name="adjustBtn' . $item_id . '" type="submit" value="Update"/&amp;gt;
		&amp;lt;input name="item_to_adjust" type="hidden" value="' . $item_id . '" /&amp;gt;
		&amp;lt;/form&amp;gt;&amp;lt;/td&amp;gt;';
		//$cartOutput .= '&amp;lt;td&amp;gt;' . $each_item['quantity'] . '&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;' . $subtotal . '&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;td&amp;gt;&amp;lt;form action="Shopping_Cart.php" method="post"&amp;gt;
		&amp;lt;input name="deleteBtn' . $item_id . '" type="submit" value="X"/&amp;gt;
		&amp;lt;input name="index_to_remove" type="hidden" value="' . $i . '" /&amp;gt;
		&amp;lt;/form&amp;gt;&amp;lt;/td&amp;gt;';
		$cartOutput .= '&amp;lt;/tr&amp;gt;';
		$i++;
	}
	setlocale(LC_MONETARY, "en_US");
	$cartTotal = money_format("%10.2n", $cartTotal);
	$cartTotal = "Cart Total: " .$cartTotal;
	
	// Finish the PayPal Checkout Button****
	$pp_checkout_btn .= '&amp;lt;input type="hidden" name="custom" value="' . $product_id_array . '"&amp;gt;
						 &amp;lt;input type="hidden" name="notify_url" value="&lt;A href="https://www.website/my_ipn.php" target="_blank"&gt;https://www.website/my_ipn.php&lt;/A&gt;"&amp;gt;
						 &amp;lt;input type="hidden" name="return" value="&lt;A href="http://www.website/checkout_complete.php" target="_blank"&gt;http://www.website/checkout_complete.php&lt;/A&gt;"&amp;gt;
						 &amp;lt;input type="hidden" name="rm" value="2"&amp;gt;
						 &amp;lt;input type="hidden" name="cbt" value="Return to Store"&amp;gt;
						 &amp;lt;input type="hidden" name="cancel_return" value="&lt;A href="http://www.website/paypal_cancel.php" target="_blank"&gt;http://www.website/paypal_cancel.php&lt;/A&gt;"&amp;gt;
						 &amp;lt;input type="hidden" name="lc" value="US"&amp;gt;
						 &amp;lt;input type="hidden" name="currency_code" value="USD"&amp;gt;
						 &amp;lt;input type="image" src="&lt;A href="http://www.website/CheckOutBtn.gif" target="_blank"&gt;http://www.website/CheckOutBtn.gif&lt;/A&gt;" height="22px" width="110px" name="submit"&amp;gt;';

}
?&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2012 20:39:43 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/31816#M16565</guid>
      <dc:creator>18thandoak</dc:creator>
      <dc:date>2012-11-30T20:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Shopping Cart: Paypal to Authorize.net</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/32102#M16700</link>
      <description>&lt;P&gt;Hello &lt;A id="link_12" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/12932" target="_self"&gt;&lt;SPAN&gt;18thandoak&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;It doesn't look like anyone has responded yet, but someone still may have feedback on what you're looking for. I'd recommend subscribing to this topic so that you'll be alerted via email if anyone else from the community is able to respond with any comments. To subscribe, click &lt;STRONG&gt;Topic Options&lt;/STRONG&gt; at the top of this thread and then select &lt;STRONG&gt;Subscribe&lt;/STRONG&gt;. You'll then receive an email once anyone replies to your post.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Richard&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2012 23:45:24 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/32102#M16700</guid>
      <dc:creator>RichardH</dc:creator>
      <dc:date>2012-12-12T23:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Shopping Cart: Paypal to Authorize.net</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/32175#M16743</link>
      <description>&lt;P&gt;Did you get this working?&lt;/P&gt;&lt;P&gt;I am working on the same thing and I am not a php person so I am lost. I would appreciate it if you were able to share how you fixed this if you got it working.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 15 Dec 2012 03:41:14 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/32175#M16743</guid>
      <dc:creator>clausont</dc:creator>
      <dc:date>2012-12-15T03:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Shopping Cart: Paypal to Authorize.net</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/76131#M47537</link>
      <description>&lt;P&gt;Thanks for sharing.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 03:52:25 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/76131#M47537</guid>
      <dc:creator>feveralburyau</dc:creator>
      <dc:date>2021-05-04T03:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Shopping Cart: Paypal to Authorize.net</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/76142#M47542</link>
      <description>&lt;P&gt;Can we add this to any random &lt;A href="https://checkfillerlists.com/one-piece/" target="_self"&gt;one piece&lt;/A&gt; or any other affilaite site? Will thsi work there?&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 11:19:39 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Custom-Shopping-Cart-Paypal-to-Authorize-net/m-p/76142#M47542</guid>
      <dc:creator>davidjohn232</dc:creator>
      <dc:date>2021-05-04T11:19:39Z</dc:date>
    </item>
  </channel>
</rss>

