JSP tag that generates a fingerprint for SIM of Authorize.net.



To use the tag in your JSP page, add the JAR to your web application, add a TLD file, and do the following.

Generate the sequence and the timestamp. I didn't include that inside the tag because you also need to supply those numbers as parameters in the form.

If you can live with a little code inside your JSP then it should look something like this:

<% String trTime=Long.toString(System.currentTimeMillis()/1000); // seconds String oSeq=Integer.toString(((int)Math.floor(Math.random()*100000d))+17354); // just a random range %>

After that, in your form, you'll have:

... <input type=hidden name="x_fp_sequence" value="<%=oSeq%>"> <input type=hidden name="x_fp_timestamp" value="<%=trTime%>"> <input type=hidden name="x_fp_hash" value="<sm2-util:AuthorizeNetSIMFingerprintHashGenerator authNetID="YOUR_ID" fingerprintSequence="<%=oSeq%>" fingerprintTimestamp="<%=trTime%>" price="YOUR_PRICE" currencyCode="" transactionKey="TRANSACTION_KEY" />"> ...

If you need to set price dynamically, then make sure to set rtexprvalue to true in your TLD file.

You can find a sample TLD file here: sm2-util-authnet.tld

The latest JAR is here: authnet-20050828.jar

I also included two classes to make calls to AIM over HTTPS. If you use AIM then you won't need to generate the fingerprint. I'm not going to describe AIM here. You can check inside the JAR, it's pretty straight forward.

If you have any questions then drop me a line at k AT goudkov DOT com

Konstantin Goudkov,
www.goudkov.com



Copyright 2005 IDF Technologies, LLC