<?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 SIM - Unique $amount for each Payment in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SIM-Unique-amount-for-each-Payment/m-p/33946#M18443</link>
    <description>&lt;P&gt;Hey everybody!&lt;BR /&gt;&lt;BR /&gt;I've build a calendar on my WordPress website, which contains different events. Some of these events cost money to attend to and for processing the payments I've chosen Authorize.Net. I spoke to Brandon from the "Live Help" tap and he said I should use SIM for this. I've therefore found the sample code on &lt;A href="http://www.authorize.net" target="_blank"&gt;www.authorize.net&lt;/A&gt; for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;!-- This section generates the "Submit Payment" button using PHP           --&amp;gt;
&amp;lt;?php
// This sample code requires the mhash library for PHP versions older than
// 5.1.2 - &lt;A href="http://hmhash.sourceforge.net/" target="_blank"&gt;http://hmhash.sourceforge.net/&lt;/A&gt;
	
// the parameters for the payment can be configured here
// the API Login ID and Transaction Key must be replaced with valid values
$loginID		= "API_LOGIN_ID";
$transactionKey = "TRANSACTION_KEY";
$amount 		= "19.99";
$description 	= "Sample Transaction";
$label 			= "Submit Payment"; // The is the label on the 'submit' button
$testMode		= "false";
// By default, this sample code is designed to post to our test server for
// developer accounts: &lt;A href="https://test.authorize.net/gateway/transact.dll" target="_blank"&gt;https://test.authorize.net/gateway/transact.dll&lt;/A&gt;
// for real accounts (even in test mode), please make sure that you are
// posting to: &lt;A href="https://secure.authorize.net/gateway/transact.dll" target="_blank"&gt;https://secure.authorize.net/gateway/transact.dll&lt;/A&gt;
$url			= "&lt;A href="https://test.authorize.net/gateway/transact.dll" target="_blank"&gt;https://test.authorize.net/gateway/transact.dll&lt;/A&gt;";

// If an amount or description were posted to this page, the defaults are overidden
if (array_key_exists("amount",$_REQUEST))
	{ $amount = $_REQUEST["amount"]; }
if (array_key_exists("amount",$_REQUEST))
	{ $description = $_REQUEST["description"]; }

// an invoice is generated using the date and time
$invoice	= date(YmdHis);
// a sequence number is randomly generated
$sequence	= rand(1, 1000);
// a timestamp is generated
$timeStamp	= time();

// The following lines generate the SIM fingerprint.  PHP versions 5.1.2 and
// newer have the necessary hmac function built in.  For older versions, it
// will try to use the mhash library.
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)); }
?&amp;gt;

&amp;lt;!-- Print the Amount and Description to the screen. --&amp;gt;
Amount: &amp;lt;?php echo $amount; ?&amp;gt; &amp;lt;br /&amp;gt;
Description: &amp;lt;?php echo $description; ?&amp;gt; &amp;lt;br /&amp;gt;

&amp;lt;!-- Create the HTML form containing necessary SIM post values --&amp;gt;
&amp;lt;form method='post' action='&amp;lt;?php echo $url; ?&amp;gt;' &amp;gt;
&amp;lt;!--  Additional fields can be added here as outlined in the SIM integration
 guide at: &lt;A href="http://developer.authorize.net" target="_blank"&gt;http://developer.authorize.net&lt;/A&gt; --&amp;gt;
	&amp;lt;input type='hidden' name='x_login' value='&amp;lt;?php echo $loginID; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_amount' value='&amp;lt;?php echo $amount; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_description' value='&amp;lt;?php echo $description; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_invoice_num' value='&amp;lt;?php echo $invoice; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_fp_sequence' value='&amp;lt;?php echo $sequence; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_fp_timestamp' value='&amp;lt;?php echo $timeStamp; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_fp_hash' value='&amp;lt;?php echo $fingerprint; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_test_request' value='&amp;lt;?php echo $testMode; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_show_form' value='PAYMENT_FORM' /&amp;gt;
	&amp;lt;input type='submit' value='&amp;lt;?php echo $label; ?&amp;gt;' /&amp;gt;
&amp;lt;/form&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is then. Since each event has a different price-tag, how do I manage this? Because in this sample code I'm only capable of assigning one $amount and that's when modifying with the "sim.php"-file. What I'm interested in is creating a&amp;nbsp;unique&amp;nbsp;$amount for each event and through some sort of Adminstrator Panel rather then the client have to dig into a ton of code.&lt;BR /&gt;&lt;BR /&gt;Could you help me or guide me in the right direction? I've been battling for a week now searching through every inch of the Internet without any promising result.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2013 20:18:30 GMT</pubDate>
    <dc:creator>FredrixDesign</dc:creator>
    <dc:date>2013-04-15T20:18:30Z</dc:date>
    <item>
      <title>SIM - Unique $amount for each Payment</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SIM-Unique-amount-for-each-Payment/m-p/33946#M18443</link>
      <description>&lt;P&gt;Hey everybody!&lt;BR /&gt;&lt;BR /&gt;I've build a calendar on my WordPress website, which contains different events. Some of these events cost money to attend to and for processing the payments I've chosen Authorize.Net. I spoke to Brandon from the "Live Help" tap and he said I should use SIM for this. I've therefore found the sample code on &lt;A href="http://www.authorize.net" target="_blank"&gt;www.authorize.net&lt;/A&gt; for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;!-- This section generates the "Submit Payment" button using PHP           --&amp;gt;
&amp;lt;?php
// This sample code requires the mhash library for PHP versions older than
// 5.1.2 - &lt;A href="http://hmhash.sourceforge.net/" target="_blank"&gt;http://hmhash.sourceforge.net/&lt;/A&gt;
	
// the parameters for the payment can be configured here
// the API Login ID and Transaction Key must be replaced with valid values
$loginID		= "API_LOGIN_ID";
$transactionKey = "TRANSACTION_KEY";
$amount 		= "19.99";
$description 	= "Sample Transaction";
$label 			= "Submit Payment"; // The is the label on the 'submit' button
$testMode		= "false";
// By default, this sample code is designed to post to our test server for
// developer accounts: &lt;A href="https://test.authorize.net/gateway/transact.dll" target="_blank"&gt;https://test.authorize.net/gateway/transact.dll&lt;/A&gt;
// for real accounts (even in test mode), please make sure that you are
// posting to: &lt;A href="https://secure.authorize.net/gateway/transact.dll" target="_blank"&gt;https://secure.authorize.net/gateway/transact.dll&lt;/A&gt;
$url			= "&lt;A href="https://test.authorize.net/gateway/transact.dll" target="_blank"&gt;https://test.authorize.net/gateway/transact.dll&lt;/A&gt;";

// If an amount or description were posted to this page, the defaults are overidden
if (array_key_exists("amount",$_REQUEST))
	{ $amount = $_REQUEST["amount"]; }
if (array_key_exists("amount",$_REQUEST))
	{ $description = $_REQUEST["description"]; }

// an invoice is generated using the date and time
$invoice	= date(YmdHis);
// a sequence number is randomly generated
$sequence	= rand(1, 1000);
// a timestamp is generated
$timeStamp	= time();

// The following lines generate the SIM fingerprint.  PHP versions 5.1.2 and
// newer have the necessary hmac function built in.  For older versions, it
// will try to use the mhash library.
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)); }
?&amp;gt;

&amp;lt;!-- Print the Amount and Description to the screen. --&amp;gt;
Amount: &amp;lt;?php echo $amount; ?&amp;gt; &amp;lt;br /&amp;gt;
Description: &amp;lt;?php echo $description; ?&amp;gt; &amp;lt;br /&amp;gt;

&amp;lt;!-- Create the HTML form containing necessary SIM post values --&amp;gt;
&amp;lt;form method='post' action='&amp;lt;?php echo $url; ?&amp;gt;' &amp;gt;
&amp;lt;!--  Additional fields can be added here as outlined in the SIM integration
 guide at: &lt;A href="http://developer.authorize.net" target="_blank"&gt;http://developer.authorize.net&lt;/A&gt; --&amp;gt;
	&amp;lt;input type='hidden' name='x_login' value='&amp;lt;?php echo $loginID; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_amount' value='&amp;lt;?php echo $amount; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_description' value='&amp;lt;?php echo $description; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_invoice_num' value='&amp;lt;?php echo $invoice; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_fp_sequence' value='&amp;lt;?php echo $sequence; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_fp_timestamp' value='&amp;lt;?php echo $timeStamp; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_fp_hash' value='&amp;lt;?php echo $fingerprint; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_test_request' value='&amp;lt;?php echo $testMode; ?&amp;gt;' /&amp;gt;
	&amp;lt;input type='hidden' name='x_show_form' value='PAYMENT_FORM' /&amp;gt;
	&amp;lt;input type='submit' value='&amp;lt;?php echo $label; ?&amp;gt;' /&amp;gt;
&amp;lt;/form&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question is then. Since each event has a different price-tag, how do I manage this? Because in this sample code I'm only capable of assigning one $amount and that's when modifying with the "sim.php"-file. What I'm interested in is creating a&amp;nbsp;unique&amp;nbsp;$amount for each event and through some sort of Adminstrator Panel rather then the client have to dig into a ton of code.&lt;BR /&gt;&lt;BR /&gt;Could you help me or guide me in the right direction? I've been battling for a week now searching through every inch of the Internet without any promising result.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2013 20:18:30 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SIM-Unique-amount-for-each-Payment/m-p/33946#M18443</guid>
      <dc:creator>FredrixDesign</dc:creator>
      <dc:date>2013-04-15T20:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: SIM - Unique $amount for each Payment</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/SIM-Unique-amount-for-each-Payment/m-p/33979#M18475</link>
      <description>&lt;P&gt;You have to store the events they want to sign up for in some way that allows you to total them up and then generate a form for just that amount using the method you already listed. I suggest looking into PHP sessions if you aren't experienced with databases and cookies:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://www.php.net/manual/en/book.session.php"&gt;http://www.php.net/manual/en/book.session.php&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2013 15:50:12 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/SIM-Unique-amount-for-each-Payment/m-p/33979#M18475</guid>
      <dc:creator>TJPride</dc:creator>
      <dc:date>2013-04-18T15:50:12Z</dc:date>
    </item>
  </channel>
</rss>

