This is the first time I have tried to use Authorize.net. I thought it would be simple, but there just isn't much in the way of Sample Code.
I want to use the form that is hosted on the authorize.net server.
First of all I am confused about the Finger print. Do I use the Transaction Key or the Signature Key?
Here is my code using the Signature Key but I get the same error with the Transaction Key:
<?php
date_default_timezone_set("UTC");
$xyz_x_fp_timestamp = time() ;
$xyz_x_fp_sequence = $xyz_x_fp_timestamp - 1489881251 ;//this will generate a unique number every second
$xyz_x_login = '123123123123';
$xyz_x_amount = 25.00;
$my_key = '222222222222222222222222';
$hash_input = $xyz_x_login.'^'.$xyz_x_fp_timestamp.'^'.$xyz_x_fp_sequence.'^'.$xyz_x_amount.'^';
$xyz_x_fp_hash = hash_hmac('sha512', $hash_input ,$my_key);
?>
<form method="post" action="https://secure.authorize.net/gateway/transact.dll">
<input type="hidden" name="x_login" value="<?php echo $xyz_x_login; ?>" >
<input type="hidden" name="x_show_form" value="PAYMENT_FORM" >
<input type="hidden" name="x_type" value="AUTH_CAPTURE" >
<input type="hidden" name="x_fp_hash" value="<?php echo $xyz_x_fp_hash; ?>" >
<input type="hidden" name="x_fp_sequence" value="<?php echo $xyz_x_fp_sequence; ?>" >
<input type="hidden" name="x_fp_timestamp" value="<?php echo $xyz_x_fp_timestamp; ?>" >
<input type="hidden" name="x_amount" value="<?php echo $xyz_x_amount; ?>" >
<p><br/><br/><input class="button" type="submit" name="submit" value="Pay $<?php echo $xyz_x_amount; ?> Now" ><br/></p>
</form>
Solved! Go to Solution.
โ03-18-2017 05:15 PM
Here is the solution.
I was suppossed to use the HD5 has instead of the SHA512 hash
$xyz_x_fp_timestamp = time() ;
$xyz_x_fp_sequence = rand(1, 10000);
$xyz_x_login = 'aaaaaaaaaaaa';
$xyz_x_amount = 25.00;
$my_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$xyz_x_fp_hash = hash_hmac('md5', sprintf('%s^%s^%s^%s^',
$xyz_x_login,
$xyz_x_fp_sequence,
$xyz_x_fp_timestamp,
$xyz_x_amount
), $my_key);
This code works!
โ03-20-2017 10:20 AM
While SIM is currently supported, it will soon be deprecated. If you are creating a new integration, we suggest using Accept Hosted, a mobile-optimized, hosted payment for that helps you meet SAQ-A level compliance.
Richard
โ03-18-2017 07:00 PM - edited โ03-18-2017 08:46 PM
Here is the solution.
I was suppossed to use the HD5 has instead of the SHA512 hash
$xyz_x_fp_timestamp = time() ;
$xyz_x_fp_sequence = rand(1, 10000);
$xyz_x_login = 'aaaaaaaaaaaa';
$xyz_x_amount = 25.00;
$my_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$xyz_x_fp_hash = hash_hmac('md5', sprintf('%s^%s^%s^%s^',
$xyz_x_login,
$xyz_x_fp_sequence,
$xyz_x_fp_timestamp,
$xyz_x_amount
), $my_key);
This code works!
โ03-20-2017 10:20 AM
Thank You Richard H. For your comments and I will look into using the newer API.
โ03-20-2017 10:21 AM