<?PHP // This sample code requires the mhash library for PHP versions older than // 5.1.2 - http://hmhash.sourceforge.net/

// the parameters for the payment can be configured here // the API Login ID and Transaction Key must be replaced with valid values

$mainamt = $GET["amount"]; $additional = $GET["additional"]; $loginID = "shannonho01"; $transactionKey = "9x54uL2g3x5D88VB"; $amount = $mainamt + $additional; $description = $_GET["description"]; $label = "Continue to Payment Details"; // 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: https://test.authorize.net/gateway/transact.dll // for real accounts (even in test mode), please make sure that you are // posting to: https://secure.authorize.net/gateway/transact.dll $url = "https://secure.authorize.net/gateway/transact.dll";

// If an amount or description were posted to this page, the defaults are overidden //if ($REQUEST["amount"]) // { $amount = $REQUEST["amount"]; } if ($REQUEST["description"]) { $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() >= '5.1.2' ) { $fingerprint = hashhmac("md5", $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey); } else { $fingerprint = bin2hex(mhash(MHASHMD5, $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey)); }

// Print the Amount and Description to the screen. echo "Amount: $amount
"; echo "Description: $description
";

// Create the HTML form containing necessary SIM post values echo "

"; // Additional fields can be added here as outlined in the SIM integration guide // at: http://developer.authorize.net echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo "
"; ?>