I need help with making so i have more text fields on the first part and have them post to my payment form i just cann't get the first and last name to do it i would also like to figure out have to put the sumit to them all on one page this is my first time ever playing with code so any help would be great.
<head>
<title>Sample SIM Implementation</title>
</head>
<body><?php
if (isset($_POST) && is_array($_POST) && count($_POST))
{
$loginID = "xxxxxxxxxxxxxxxxxx";
$transactionKey = "xxxxxxxxxxxxxxx";
$description = "Please put Defendants name Here";
$testMode = "false";
$amount = (float) trim($_REQUEST["x_amount"]);
$FirstName = (float) trim($_REQUEST["x_firstname"]);
$LastName = (float) trim($_REQUEST["x_lastname"]);
$Address = (float) trim($_REQUEST["x_address"]);
$city = (float) trim($_REQUEST["x_city"]);
$state = (float) trim($_REQUEST["x_state"]);
$zip = (float) trim($_REQUEST["x_zip"]);
$invoice = date(YmdHis);
$sequence = rand(1, 1000);
$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 = hash_hmac("md5", $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey);
}
else
{
$fingerprint = bin2hex(mhash(MHASH_MD5, $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey));
}
?>
<form method="post" action="https://test.authorize.net/gateway/transact.dll"><input value="<?php echo $loginID; ?>" type="hidden" name="x_login" /> <input value="<?php echo $amount; ?>" type="hidden" name="x_amount" /> <input value="<?php echo $FirstName; ?>" type="hidden" name="x_firstname" /> <input value="<?php echo $LastName; ?>" type="hidden" name="x_lastname" /> <input value="<?php echo $Address; ?>" type="hidden" name="x_address" /> <input value="<?php echo $city; ?>" type="hidden" name="x_city" /> <input value="<?php echo $state; ?>" type="hidden" name="x_state" /> <input value="<?php echo $zip; ?>" type="hidden" name="x_zip" /> <input value="<?php echo $description; ?>" type="hidden" name="x_description" /> <input value="<?php echo $invoice; ?>" type="hidden" name="x_invoice_num" /> <input value="<?php echo $sequence; ?>" type="hidden" name="x_fp_sequence" /> <input value="<?php echo $timeStamp; ?>" type="hidden" name="x_fp_timestamp" /> <input value="<?php echo $fingerprint; ?>" type="hidden" name="x_fp_hash" /> <input value="<?php echo $testMode; ?>" type="hidden" name="x_test_request" /> <input value="PAYMENT_FORM" type="hidden" name="x_show_form" /> <input value="Submit Payment" type="submit" /> </form><?php
}
else
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">Amount: <input type="text" name="x_amount" /> First Name: <input value="<?php echo $FirstName; ?>" type="text" name="x_FirstName" /> Last Name: <input value="<?php echo $LastName; ?>" type="text" name="x_LastName" /> Address: <input value="<?php echo $address; ?>" type="text" name="x_address" /> city: <input value="<?php echo $city; ?>" type="text" name="x_city" /> state: <input value="<?php echo $state; ?>" type="text" name="x_state" /> zip: <input value="<?php echo $zip; ?>" type="text" name="x_zip" /> <input value="AMOUNT" type="submit" /> </form><?php
}
?>
</body>
</html>
Solved! Go to Solution.
06-14-2011 10:14 PM
I got it working thanks i didn't have the names in the echo fingerprint
06-15-2011 08:14 AM
06-15-2011 06:26 AM
Thanks i tried that still not getten the first last name in the and how do i make it so the text areas are under each other
06-15-2011 06:39 AM
I got it working thanks i didn't have the names in the echo fingerprint
06-15-2011 08:14 AM
Here it is if someone is looking for something like this added more fields to echo to payment gateway
<?php
if (isset($_POST) && is_array($_POST) && count($_POST))
{
$loginID = "xxxxxxxxxxxxx";
$transactionKey = "xxxxxxxxxxxxxxxxx";
$description = "xxxxxxxxxxxxxxx";
$testMode = "false";
$amount = ($_REQUEST["x_amount"]);
$first_name = ($_POST["x_first_name"]);
$last_name = ($_POST["x_last_name"]);
$Address = ($_REQUEST["x_address"]);
$city = ($_REQUEST["x_city"]);
$state = ($_REQUEST["x_state"]);
$zip = ($_REQUEST["x_zip"]);
$email = ($_REQUEST["x_email"]);
$phone = ($_REQUEST["x_phone"]);
$invoice = date(YmdHis);
$sequence = rand(1, 1000);
$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 = hash_hmac("md5", $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount ."^", $transactionKey);
}
else
{
$fingerprint = bin2hex(mhash(MHASH_MD5, $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey));
}
?>
<form method="post" action="https://test.authorize.net/gateway/transact.dll"><input value="<?php echo $loginID; ?>" type="hidden" name="x_login" /> <input value="<?php echo $amount; ?>" type="hidden" name="x_amount" /> <input value="<?php echo $first_name; ?>" type="hidden" name="x_first_name" /> <input value="<?php echo $last_name; ?>" type="hidden" name="x_last_name" /> <input value="<?php echo $Address; ?>" type="hidden" name="x_address" /> <input value="<?php echo $city; ?>" type="hidden" name="x_city" /> <input value="<?php echo $state; ?>" type="hidden" name="x_state" /> <input value="<?php echo $zip; ?>" type="hidden" name="x_zip" /> <input value="<?php echo $description; ?>" type="hidden" name="x_description" /><input value="<?php echo $email; ?>" type="hidden" name="x_email" /><input value="<?php echo $phone; ?>" type="hidden" name="x_phone" /> <input value="<?php echo $invoice; ?>" type="hidden" name="x_invoice_num" /> <input value="<?php echo $sequence; ?>" type="hidden" name="x_fp_sequence" /> <input value="<?php echo $timeStamp; ?>" type="hidden" name="x_fp_timestamp" /> <input value="<?php echo $fingerprint; ?>" type="hidden" name="x_fp_hash" /> <input value="<?php echo $testMode; ?>" type="hidden" name="x_test_request" /> <input value="PAYMENT_FORM" type="hidden" name="x_show_form" /> <input value="Continue to Our Secure Server" type="submit" /> </form><?php
}
else
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p>Amount: <input type="text" name="x_amount" /> </p>
<div>First Name: <input value="<?php echo $first_name; ?>" type="text" name="x_first_name" /> </div>
<div>Last Name: <input value="<?php echo $last_name; ?>" type="text" name="x_last_name" /> </div>
<div>Address: <input value="<?php echo $address; ?>" type="text" name="x_address" /> </div>
<div>city: <input value="<?php echo $city; ?>" type="text" name="x_city" /></div>
<div>state: <input value="<?php echo $state; ?>" type="text" name="x_state" /></div>
<div> zip: <input value="<?php echo $zip; ?>" type="text" name="x_zip" />
<div>Email: <input value="<?php echo $email; ?>" type="text" name="x_email" /> </div>
<div>Phone Number: <input value="<?php echo $phone; ?>" type="text" name="x_phone" /> <input value="NexT Page" type="submit" /> </div></form><?php
}
?> </div>
06-15-2011 08:18 AM