#16
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0
    Hi,
    Jeff, thanks to you for replying as well. I should add at this stage all of my work is done in FlashMX, I am pretty new to php and have very little knowledge of html - lol!!!
    So, I have removed the relay response url from the MI and turned off test mode as this is set to true in my sim file.
    The only variables I am passing to the payment form are x_first_name and x_last_name and x_email, so I have added these to my sim script correctly.
    The amount, description and currency are fixed as this is a membership site.
    Next the only var I want back from the relay response is the x_email.
    This is my sim.php file - I have changed very little from the downloaded version from AN
    PHP Code:
     <!--

      DISCLAIMER:
         This code is distributed in the hope that it will be useful, but without any warranty; 
         without even the implied warranty of merchantability or fitness for a particular purpose.

       Main PHP that demonstrates how to use the SIM library. 
       Input (Form or QueryString):
          x_Amount
          x_Description
    -->

    <HTML>
    <HEAD>
    <TITLE>Membership Form</TITLE>
    </HEAD>
    <BODY>
    <H3>Final Order</H3>

    <?
    $x_Description 
    "Membership";
    $x_Amount "$9.95";
    $currencycode "USD";
    ?>

    Description: <?=$x_Description?>  <BR />
    Total Amount : <?=$x_Amount?>

    <BR /><BR />
    <FORM action="https://certification.authorize.net/gateway/transact.dll" method="POST">
    <?

    // authdata.php contains the loginid and txnkey. 
    // You may use a more secure alternate method to store these (like a DB / registry).

    include ("simdata.php"); 
    include (
    "simlib.php");

    $amount $x_Amount;

    // Trim $ sign if it exists
    if (substr($amount0,1) == "$") {
        
    $amount substr($amount,1);
    }
    // I would validate the Order here before generating a fingerprint

    // Seed random number for security and better randomness.

    srand(time());
    $sequence rand(11000);
    // Insert the form elements required for SIM by calling InsertFP
    //$ret = InsertFP ($loginid, $txnkey, $amount, $sequence);

    //*** IF YOU ARE PASSING CURRENCY CODE uncomment and use the following instead of the InsertFP invocation above  ***
     
    $ret InsertFP ($loginid$txnkey$amount$sequence$currencycode);

    // Insert rest of the form elements similiar to the legacy weblink integration
    echo ("<input type=\"hidden\" name=\"x_description\" value=\"" $x_Description "\">\n" );
    echo (
    "<input type=\"hidden\" name=\"x_login\" value=\"" $loginid "\">\n");
    echo (
    "<input type=\"hidden\" name=\"x_amount\" value=\"" $amount "\">\n");
    echo (
    "<input type=\"hidden\" name=\"x_first_name\"value=\"".$firstname."\">\n");//this and the next 2lines are the vars that I am passing to the payment page from Flash - they all work OK
    echo ("<input type=\"hidden\" name=\"x_last_name\"value=\"".$lastname."\">\n");
    echo (
    "<input type=\"hidden\" name=\"x_email\"value=\"".$mailAddy."\">\n");
    echo (
    "<input type=\"hidden\" name=\"x_Relay_Response\"value=\"TRUE\">\n");
    echo (
    "<input type=\"hidden\" name=\"x_Relay_URL\"value=\"http://www.mydomain.com/scripts/monRec.php\">\n");
    echo (
    "<input type=\"submit\"value =\"Click here for secure payment form\">\n");


    // *** IF YOU ARE PASSING CURRENCY CODE uncomment the line below *****
    echo ("<input type=\"hidden\" name=\"x_currency_code\" value=\"" $currencycode "\">\n");

    ?>
    <INPUT type="hidden" name="x_show_form" value="PAYMENT_FORM">
    <INPUT type="hidden" name="x_test_request" value="TRUE">
    <INPUT type="submit" value="Accept Order">
    </FORM>
    </BODY>
    </HTML>
    The interesting thing to note is that if a have an error in my monRec.php, when I click on submit ( on the payment form) it tells me the error, which indicates that the file is being opened, I have tested this file in a browser and there are no errors in it at all (now).
    Anyway, if either of you can throw any light on this I might be able to keep some hair(lol!!)
    Very late here now, so my last post for tonight - thank you both again

    SteveD
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    San Ramon, CA
    Posts
    72
    Rep Power
    13
    In your code you have

    echo ("<input type=\"hidden\" name=\"x_Relay_URL\"value=\"http://www.mydomain.com/scripts/monRec.php\">\n");


    I vaguely remember something about this
    I believe this can be set up in the administration of the actual account. I think the adminsetting may have priority over this line of code or worse yet cause an error if both exist.

    Make sure the the admin version is set correctly to your monRec.php page and then try eliminating this line from your code and see if you get any changes

    Good Luck
    Jeff
  4. #18
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0
    Hi,
    Good idea Jeff, but I already tried ALL the different permutaions,
    I have relay response set in the sim.php file & and at the MI along with test mode set to true in both, I have tried it with the settings just in the sim file and with the setting just at the MI.
    I have double checked my monRec.php, I am only pulling in one variable from the payment gateway which is the email address, I have set this to $emailAddy ( which is the var I sendto the PG )and have I have tried this set to $x_email, still the same error exists....................

    Really really stuck now, driving me nuts !

    Thanks for your suggestions

    SteveD
  6. #19
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    San Ramon, CA
    Posts
    72
    Rep Power
    13
    I looked at my code quickly and I do not even have the x_Relay_URL set anywhere in my code so mine is relying strictly on the interface information. I will scan it agin tomorrow and see if I can see anything else my biggest problem was the case issue. ARe you using the two file they say to download if so double check the case in those as well. After my issue I took nothing for granted as being correct. did they give you a link to verify information being sent not just the mhash stuff but the actual data also IF not let me know and I will check my email for the link they gave meit sort of verfied if the relay part was working as well

    Jeff
  8. #20
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0
    Hi,
    Is it late or early where you are ?
    No, AN haven't given me any links, in fact very little help other that to refer me to the tech notes !
    With the mdhash, I did this, I used the code snippet that the dude provided earlier in this post, opened it in a browser ( from my server), it returned 2 values, one for hash and on for hmac, I pasted the hash values in the required place at the MI. Is that the right way to do it - mdhash is a complete mystery to me.
    I have just run an error test on my monRec.php and nothing is wrong there - i will now go and check the sim lib file

    Cheers

    SteveD
  10. #21
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    San Ramon, CA
    Posts
    72
    Rep Power
    13
    HI Steve it is getting late currently 12:07 AM but I am working on another site also

    I found the email with the link here it is it may be of some help


    Greetings from Authorize.Net!

    What one of the other reps has available is a page that will echo back the variable names and values. Then you will be able to pull up exactly how the variable names are spelled with the correct case.

    http://www31.brinkster.com/washnwax/nvsplit2.asp

    Hopefully, our new documentation will be clearer about variable names regarding case sensitivity.

    If your response still doesn't work, give us a call back so we can escalate the notification error issue to our engineers.

    Thank you for contacting our customer service group.
    Please let us know if there is anything we can do to help you in the future.

    Trina
    Authorize.Net
    Customer Support

    Please do not delete any part of this email when responding to aid the tracking and resolution of this issue.

    This e-mail and any attachments may contain confidential information that is legally privileged. The information is solely for the use of the intended recipient(s); any disclosure, copying, distribution, or other use of this information is strictly prohibited. If you have received this e-mail in error, please notify the sender by return e-mail and delete this message.


    Ther is some setup you will need to do but it may help verify something again it is more to do with case sensitivty but it may show you something useful

    Jeff
  12. #22
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    15
    Rep Power
    0
    SteveD,

    You should only specify the response URL in the MI. The only thing you need to include in sim.php is ...

    <input type="hidden" name="x_Relay_Response" value="TRUE">

    This should then direct the response to the URL specified in the MI.

    The following is the code from the sim.php file I got working. You should not have to modify simlib.php at all. The testing flag should also be set in the MI.

    <?
    include ("simlib.php");

    // You may want to store this more securely in a DB or Registry or a Encrypted File
    $loginid = "loginID";
    $txnkey = "txnKeyFromAuthNet";

    $x_Description = "Test Description";
    $x_Amount = 18;
    ?>
    <html>
    <head>
    <title>order form</title>
    </head>
    <body>
    <h3>final order</h3>


    Description: <?=$x_Description?>
    <br>
    Total Amount : <?=$x_Amount?>

    <br><br>
    <form action="https://certification.authorize.net/gateway/transact.dll" method="POST">
    <?

    $amount = $x_Amount;

    // Trim $ sign if it exists
    if (substr($amount, 0,1) == "$") {
    $amount = substr($amount,1);
    }
    // I would validate the Order here before generating a fingerprint

    // Seed random number for security and better randomness.

    srand(time());
    $sequence = rand(1, 1000);
    // Insert the form elements required for SIM by calling InsertFP
    $ret = InsertFP ($loginid, $txnkey, $amount, $sequence);

    //*** IF YOU ARE PASSING CURRENCY CODE uncomment and use the following instead of the InsertFP invocation above ***
    // $ret = InsertFP ($loginid, $txnkey, $amount, $sequence, $currencycode);

    <input type="hidden" name="x_Description" value="<?= $x_Description ?>">
    <input type="hidden" name="x_Login" value="<?= $loginid ?>">
    <input type="hidden" name="x_Amount" value="<?= $amount ?>">
    <input type="hidden" name="x_Type" value="AUTH_CAPTURE">
    <input type="hidden" name="x_Method" value="CC">
    <input type="hidden" name="x_Card_Num" value="4222222222222">
    <input type="hidden" name="x_Exp_Date" value="08/2003">
    <input type="hidden" name="x_Version" value="3.1">
    <input type="hidden" name="x_Relay_Response" value="TRUE">
    <input type="submit" value="Accept Order">
    </form>
    </body>
    </html>

    I hope this helps.

    Regards,
    coder4hire
  14. #23
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0
    Hi Guys,
    just wanted to say thanks for your help, it seems, after a long chat with AN, that you cannot have a relay response AND reciept page, and they tell me that they are phasing out realay response anyway.
    So in order to send variables back to a php script I had to set up my own reciept page.
    Everything is working well now, no small thanks to you 2

    Thanks again

    SteveD
  16. #24
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    8
    Rep Power
    0

    Hi Guys


    I am a regular user of this forum but posting first time the query on it
    I hope i would get the result fast.

    Well the problem is regarding the SIM integration of the Authorize.net
    All the settings are fine and also i am redirected back to the site where i want.
    But i am constantly getting the error code 99 that is
    the merchant fingerprint is not equal to the server fingerprint.

    I tried many times and the functions used are also correct.
    Only not getting the fingerprint same.

    Please help me out soon.

    Thanks
  18. #25
  19. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0
    Hi Devinder,
    Not sure I can help you out here as this was not a problem that I had - have you checked that mhash feature is turned on with your host - try this code snippet ( posted by the dude on the previous page to this thread)
    PHP Code:
    <?php
    $input 
    "what do ya want for nothing?";
    $hash mhash (MHASH_MD5$input);
    print 
    "The hash is ".bin2hex ($hash)."<br />\n";
    $hash mhash (MHASH_MD5$input"Jefe");
    print 
    "The hmac is ".bin2hex ($hash)."<br />\n";
    ?>
    Copy and paste that into a php file, upload to your site and and open the file in your browser - if the feature is on you will have 2 numbers, the mhash number you need to copy and paste into correct place at the user interface at AN.

    I found a lot of the documentation and related tech notes/instructions were out of date with AN and the only way I discovered this was to talk to them directly.

    Anyway try the above and see - if it still doesn't work I would double check everything for typo's - 'bout all I can suggest for now without seeing your set up

    Hope it helps

    SteveD
  20. #26
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    8
    Rep Power
    0

    thank


    Thanks for the Quick reply.

    Well the Mhash was not installed previously .
    But got it installed on the server.
    I can aslo see the php compiled with the Mhash in the phpinfo

    I get the error code that the fingerprint generated on the merchant end does not match the finger print of the authorize.net

    therefore they reject the transaction and i get the error as some problem in the transaction (Error_code = 3 )

    I rechecked the transaction key but it is also right.
    using the sim scripts that the authorize provide for the transaction.

    Currency code is left blank as it would be USD

    Not getting where the problem is ??

    Hope I get the solution for this
  22. #27
  23. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0
    Have you tried putting the currency code in, the site I was working on was also in $, but I inserted it anyway. The other thing to check is that your $loginid (insimdata.php) is the same as your userID at AN.
    Hope you can get it sorted - problems like this nearly always turn out to be something simple ( and silly). If I can think of anything else I will post again
    SteveD
  24. #28
  25. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    8
    Rep Power
    0
    Thanks for your reply.

    Well I checked with the login .It is right .
    I did add the Currency this time as "USD"

    But no success .
    Does that authorize generate a unique finger print for every user?
    As i get a constant the same number from the Authorize.net with the variable x_MD5_Hash

    Can their be any other fault out here

    I am getting sick
  26. #29
  27. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    11
    Rep Power
    0
    Hi,
    Couple of things you can check
    1) If you are copying and pasting numbers/text between your PC and AN double check there are no trailing spaces.
    2)I am assuming you are in test mode - are you using the cirrect url for test mode :

    LIVE
    <FORM action="https://secure.authorize.net/gateway/transact.dll" method="POST">

    TEST
    <FORM action="https://certification.authorize.net/gateway/transact.dll" method="POST">

    Using the wrong url when AN is set to test will throw up a footprint error - give it a try as I am running out of ideas for you - lol!!!

    SteveD
  28. #30
  29. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    8
    Rep Power
    0
    Thanks for the Clue.

    Well I though it was a break !!!
    But unfortunately that too did not work out.

    I constantly get this
    86EDAFFFD2B95F022B5479508CB2B0A7

    This hash only from the authorize after checking the variable returned by the server.

    Do they generate a keyword per user and that keyword is constant for a particular user ??

    Going crazy now (

    Thanks
    Hope for the best

IMN logo majestic logo threadwatch logo seochat tools logo