Reply
Member
Posts: 5
Registered: ‎03-18-2017
Accepted Solution

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>

Posts: 2,178
Topics: 50
Kudos: 142
Blog Posts: 64
Registered: ‎12-05-2011

Re: SIM using php

[ Edited ]

@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

--------

Webhooks are now available for Authorize.Net

Using SOAP, see our deprecation notice.
Check out Accept.js, our Javascript replacement for DPM.
Pro Tip: Never use test mode in the sandbox, instead use the Testing Guide.
Member
Posts: 5
Registered: ‎03-18-2017

Re: SIM using php

 

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!

Highlighted
Member
Posts: 5
Registered: ‎03-18-2017

Re: SIM using php

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