Authorize.Net API questions and help with your payment integration.
Authorize.Net API questions and help with your payment integration.
10-07-2011 10:26 AM
I keep getting this error: (97) This transaction cannot be accepted. I am using ColdFusion for my code.
I am using the Source Code downloaded from http://developer.authorize.net/downloads/samplecode/?searchid=1317927783498 under SIM - ColdFusion. Only mods is my Login ID and Transaction key and the Dumps to see the values and adding seconds to the time Explained below).
My server is EST and I add 18000 seconds to it to make it GMT time. In the code, I post the EST Time, the GMT Time I create by adding 18000 seconds, then the Seconds. The code gives all the values I used and dumps them on the screen. If you view the source, you will see that this value is what is passed in the form.
My code is working (no errors and you can see my error response on submit), you will just need to add your own Login ID and transaction key to test, IF you want to test. Also if you server is a different timezone than EST, the seconds added will need to be different.
If I take the value that my page creates, and put it in theAuthorize.net Test at http://developer.authorize.net/tools/responsecode97/ it works. This value can be taken from the 1st variable display, when you view source and take the value out of the field x_fp_timestamp (that passes the time stamp value) and after the form for the 2nd variable dump. Value never changes through out the entire process once the variable is set (Variable name is timestamp).
Below is my code, that you can view for problems, errors or whatever or you can use and test:
<CODE START> --------
This sample code is designed to connect to Authorize.net using the SIM method.
For API documentation or additional sample code, please visit:
Most of this page below (and including) this comment can be modified using any
standard html. The parts of the page that cannot be modified are noted in the
comments. This file can be renamed as long as the file extension remains .cfm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<TITLE> Sample SIM Implementation </TITLE>
<!-- This section generates the "Submit Payment" button using Coldfusion -->
<!--- the parameters for the payment can be configured here --->
<!--- the API Login ID and Transaction Key must be replaced with valid values --->
<cfset loginID="MUST ENTER LOGIN ID">
<cfset transactionKey="MUST ENTER TRANSACTION KEY">
<cfset description="Sample Transaction">
<cfset label="Submit Payment"> <!--- The is the label on the 'submit' button --->
<!--- <cfset testMode="false"> --->
<!--- 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:
<!--- an invoice is generated using the date and time --->
<cfset invoice=DateFormat(Now(),"yyyymmdd") & TimeFormat(Now(),"HHmmss")>
<!--- a sequence number is randomly generated --->
<cfset sequence=RandRange(1, 1000)>
<!--- a timestamp is generated --->
<!--- Get current time. --->
<cfset dtNow = Now() />
<!--- Convert to GMT using UTC Offset. --->
<cfset dtGMT = DateAdd("s",GetTimeZoneInfo().UTCTotalOffset,dtNow) /> <!--- CODE FOR EST TO GMT - NO DAY LIGHT SAVINGS TIME CONSIDERATION --->
<cfset dtGMT = DateAdd("s",3600,dtGMT) /> <!--- ADDED 3600 seconds TO TAKE INTO ACCOUNT DAY LIGHT SAVINGS TIME --->
<!--- <cfdump var="#GetTimeZoneInfo().UTCTotalOffset#"> --->
<cfset timestamp=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', dtGMT)) >
<cfset timestamp = trim(timestamp)> <!--- TRIM VARIABLE TO MAKE SURE THERE WAS NO LEADING OR FOLLOWING SPACES --->
<!--- <cfset timestamp=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now())) > --->
<cfset timestamp2=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now())) >
<!--- <cfset timestamp=DateConvert('local2UTC', Now())> --->
<!--- The following lines generate the SIM fingerprint --->
<cf_hmac data="#loginID#^#sequence#^#timestamp#^#amount#^" key="#transactionKey#">
<!--- Print the Amount and Description to the screen.--->
<strong>Amount:</strong> #amount# <br />
<strong>Description:</strong> #description# <br />
<strong>DateTime:</strong> #dtNow# - (COMES FROM HOSTED SERVER)<br />
<strong>GMT:</strong> #dtGMT# - (DATE MY CODE CREATES)<br />
<strong>timestamp:</strong> #timestamp# - (USED IN FORM BELOW - SAME VARIABLE / SAME VALUE)</br></br>
<strong><em>Backward Compatibility test:</em></strong><BR>
<strong>GMT Timestamp Seconds:</strong> <cfdump var="#timestamp#"> <BR>
<strong>EMT Timestamp Seconds:</strong> <cfdump var="#timestamp2#"><BR>
<cfset vDif = timestamp - timestamp2>
<strong>Difference:</strong> <cfdump var="#vDif#"> - <em>Amount to add to make it 5 hours ahead like Authorize.net needs.</em> <BR><BR>
<font color="##800000">**************************************** START FORM SECTION ****************************************************</font><BR>
Form to submit to https://secure.authorize.net/gateway/transact.dll - <BR><BR>
<!--- Create the HTML form containing necessary SIM post values --->
<FORM method='post' action='#posturl#' >
<!--- Additional fields can be added here as outlined in the SIM integration
guide at http://developer.authorize.net --->
<INPUT type='hidden' name='x_login' value='#loginID#' />
<INPUT type='hidden' name='x_amount' value='#amount#' />
<INPUT type='hidden' name='x_description' value='#description#' />
<INPUT type='hidden' name='x_invoice_num' value='#invoice#' />
<INPUT type='hidden' name='x_fp_sequence' value='#sequence#' />
<INPUT type='hidden' name='x_fp_timestamp' value='#timestamp#' />
<INPUT type='hidden' name='x_fp_hash' value='#fingerprint#' />
<INPUT type='hidden' name='x_test_request' value='#testMode#' />
<INPUT type='hidden' name='x_show_form' value='PAYMENT_FORM' />
<input type='submit' value='#label#' />
<!-- This is the end of the code generating the "submit payment" button. -->
If you view source you will see that the form field <em>x_fp_timestamp</em> will have the same value as the dump above and below!<BR>
<font color="##800000">**************************************** END FORM SECTION *******************************************************</font><BR>
<strong>Timestamp dump to make sure that the timestamp did not change:</strong><BR>
<cfdump var="#timestamp#"> <BR>
<!-- The last line is a necessary part of the coldfusion script -->
-------- <CODE END>
I have talked to tech support and they said to post on here, because they see no problem, but they are not developers. But they also said it can not be on their end. So there is a problem somewhere between.
Thanks in advance,
10-07-2011 11:46 AM
Are you sure it is not 4 hour ahead since it is still daylight savings time(EDT).
Also, it would be easier to set it in your account and then you can just sent in your server current time.
login to https://test.authorize.net
Account - Settings - Business Settings - Time Zone
11-09-2011 09:33 AM
Robert B at authorize.net chat says:
Robert B: Yes, our tech's agree the Time Zone setting will not effect that error you are getting.
So the info above from RaynorC1emen7 is incorrect.
11-09-2011 01:10 PM
Response Reason Code: 97
Response Reason Text: This transaction cannot be accepted.
Other Suggestions: Applicable only to the SIM API. Fingerprints are only valid for a short period of time. This code indicates that the transaction fingerprint has expired.
The fingerprint is obviously the problem. If you're using the demo code and the only thing you're changing is the timestamp, my guess would be that the timestamp is being read as invalid for some reason and therefore the fingerprint is being rejected. In any case, it's a place to start.