Reply
Member
Posts: 4
Registered: ‎05-14-2012
Accepted Solution

Using SIM or Direct Post VIA a URL only

[ Edited ]

Ive read all the documentaiton on SIM and directpost and I've searched the forums and not found a good answer on this: (i got the hash from the sim PHP samples online and I'm just trying to construct a url that takes me into the gateway)

 

https://test.authorize.net/gateway/transact.dll?&x_login=3efkewfff&x_type=AUTH_CAPTURE&x_amount=1.20...

 

I have a cart system I wrote that allows paypal already and i just want to give the option of authorize.net for my customers. Its an online registration system that tallies up the total registrations and then when the user hits the submit payment they redirect to paypal and pay then IPN fires back to my script and i process it.

for instance heres what i do with paypal:


 ff_redirect("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=$paypalemail&item_name=Registration for $eventname&item_number=$tournamentid,$groupregid,$totalcharges&amount=$totalcharges&currency_code=USD&return=http://www.myurl.com&cancel_return=http://www.myurl.com/files/payments/ipn_res.php&notify_url=http:/...",'post');

 

Thanks for any insight ive been all over http://www.authorize.net/support/SIM_guide.pdf and it seems like i really hope this is possible and it seems as though it should be but all i get is password is not correct errormsgs

 

 

David


Accepted Solutions
Solution
Accepted by topic author shinzan
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎05-14-2012

Re: Using SIM or Direct Post VIA a URL only


All Replies
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Using SIM or Direct Post VIA a URL only

[ Edited ]

https://test.authorize.net/gateway/transact.dll?x_version=3.1&x_show_form=PAYMENT_FORM&x_method=CC&x...[yourloginID]&x_type=AUTH_CAPTURE&x_amount=19.99&x_delim_data=FALSE&x_fp_sequence=491&x_fp_timestamp=1337027314&x_fp_hash=766397aa7ecd3a836b7b09576f14bbc0&x_relay_response=TRUE&x_relay_URL=https://developer.authorize.net/tools/paramdump/index.php

 

Basically you need the

x_version=3.1

x_show_form=PAYMENT_FORM

x_method=CC

x_login=[yourloginID]

x_type=AUTH_CAPTURE

x_amount=19.99

x_delim_data=FALSE

x_fp_sequence=491

x_fp_timestamp=1337027314

x_fp_hash=766397aa7ecd3a836b7b09576f14bbc0

x_relay_response=TRUE

x_relay_URL=https://developer.authorize.net/tools/paramdump/index.php

 

To see how to generate the x_fp_hash and x_fp_timestamp, download the SIM php sample code.

Member
Posts: 4
Registered: ‎05-14-2012

Re: Using SIM or Direct Post VIA a URL only

Thanks for the info, it seems to be exactly what i need, however i still get this error msg:

 

The following errors have occurred.

(13) The merchant login ID or password is invalid or the account is inactive.

 

Here is my code that I reworked for people who want cut and paste functionality for this feature:

 

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

$x_login = "[INSERTLOGINIDHERE]";      //API Login ID
$transactionKey = "[INSERTTRANSACTIONKEYHERE]";
$description = "Sample Transaction";

$x_version = "3.1";
$x_show_form = "PAYMENT_FORM";
$x_method = "CC";
$x_type = "AUTH_CAPTURE";
$x_amount = "1.99";
$x_delim_data = "FALSE";
$x_fp_sequence =  rand(1, 1000); // a sequence number is randomly generated
$x_fp_timestamp = time();
$x_fp_hash = ""; // this will be determined below
$x_relay_response = "TRUE";
$x_relay_URL = "https://developer.authorize.net/tools/paramdump/index.php";

// an invoice is generated using the date and time
$invoice = date(YmdHis);


// 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' ) {
   $x_fp_hash = hash_hmac("md5", $x_login . "^" . $x_fp_sequence . "^" . $x_fp_timestamp . "^" . $x_amount . "^", $transactionKey);
} else     {
   $x_fp_hash = bin2hex(mhash(MHASH_MD5, $x_login . "^" . $x_fp_sequence . "^" . $x_fp_timestamp . "^" . $x_amount . "^", $transactionKey));
}

// 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://test.authorize.net/gateway/transact.dll";


echo "$url?x_version=$x_version&x_show_form=$x_show_form&x_method=$x_method&x_login=$x_login&x_type=$x_type&x_amount=$x_amount&x_delim_data=$x_delim_data&x_fp_sequence=$x_fp_sequence&x_fp_timestamp=$x_fp_timestamp&x_fp_hash=$x_fp_hash&x_relay_response=$x_relay_response&x_relay_URL=$x_relay_URL";

 

This ends up with the following URL

 

https://test.authorize.net/gateway/transact.dll?x_version=3.1&x_show_form=PAYMENT_FORM&x_method=CC&x...

 

And of course redirecting to that url or copy pasting gives me:

 

The following errors have occurred.

(13) The merchant login ID or password is invalid or the account is inactive.

 

I feel like I'm missing something simple because i know the login and transaction key are correct as i copied them straight from Virtuemart settings.

 

Thanks,

 

David

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Using SIM or Direct Post VIA a URL only

My guess it that you are using a live production account loginID, transactionKey to post to the test server.

Can't do that, get a test account to post to the test server.

 

Test Accounts vs. Live Accounts – Which Does What Anyway?

Solution
Accepted by topic author shinzan
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎05-14-2012

Re: Using SIM or Direct Post VIA a URL only

excellent point :P

Member
Posts: 4
Registered: ‎05-14-2012

Re: Using SIM or Direct Post VIA a URL only

Also to help anyone whos using PHP here is a thread with a good sample relay response script, i found this missing from the sdk and think this is an important sample that should be more prominent:

 

http://community.developer.authorize.net/t5/Integration-and-Testing/relay-response-in-php/m-p/4315