cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

SIM using php

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>

PeggyMe
Member
1 ACCEPTED SOLUTION

Accepted Solutions

 

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!

View solution in original post

PeggyMe
Member
3 REPLIES 3

@PeggyMe 

 

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

RichardH
Administrator Administrator
Administrator

 

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!

PeggyMe
Member

Thank You Richard H. For your comments and I will look into using the newer API.

PeggyMe
Member