I've been having trouble getting authorize.net to work. I downloaded the sample code, signed up for a test account, and replaced the x_login and x_tran_key, but it always gives me this message:
I've also tried my company's normal x_login/x_tran_key combo and it says the same thing. Any idea what I'm doing wrong?
Thank you.
09-17-2012 07:17 AM
Try viewing the browser page source when you run it. Make sure there isn't any extra space.
09-17-2012 07:30 AM
It looks to be about what I expect it should, besides the error message:
<OL> | |
<LI>3 </LI> | |
<LI>2 </LI> | |
<LI>13 </LI> | |
<LI>The merchant login ID or password is invalid or the account is inactive. </LI> | |
<LI> </LI> | |
<LI>P </LI> | |
<LI>0 </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI>19.99 </LI> | |
<LI> </LI> | |
<LI>auth_capture </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI> </LI> | |
<LI>F5FB0412546E713FCEC05FA033DCD235 </LI> | |
</OL> |
09-17-2012 07:32 AM
Sorry, what I mean was at the "Submit Payment" button screen, check the loginID, transactionKey, etc.
09-17-2012 07:38 AM
Oh, right. Well the x_login/x_tran_key strings don't have any extra space.
post_values.Add "x_login", "7c6BAa7Q8Ku"
post_values.Add "x_tran_key", "7kzH87fM8Scm53ff"
That's just my test account that I activated this morning.
09-17-2012 07:42 AM
I just try it with your test account info and it work fine. You didn't change the URL to secure.authorize.net which is for production account?
and sometime it required to set the
objRequest.setRequestHeader "Content-length", post_string.length
09-17-2012 07:47 AM - edited 09-17-2012 07:57 AM
Added that line in and it's giving me the same thing.
This is what I'm using:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML lang='en'>
<HEAD>
<TITLE> Sample AIM Implementation </TITLE>
</HEAD>
<BODY>
<P> This sample code is designed to generate a post using Authorize.net's
Advanced Integration Method (AIM) and display the results of this post to
the screen. </P>
<P> For details on how this is accomplished, please review the readme file,
the comments in the sample code, and the Authorize.net AIM API documentation
found at http://developer.authorize.net </P>
<HR />
<%
' 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
Dim post_url
post_url = "https://test.authorize.net/gateway/transact.dll"
Dim post_values
Set post_values = CreateObject("Scripting.Dictionary")
post_values.CompareMode = vbTextCompare
'the API Login ID and Transaction Key must be replaced with valid values
post_values.Add "x_login", "7c6BAa7Q8Ku"
post_values.Add "x_tran_key", "7kzH87fM8Scm53ff"
post_values.Add "x_delim_data", "TRUE"
post_values.Add "x_delim_char", "|"
post_values.Add "x_relay_response", "FALSE"
post_values.Add "x_type", "AUTH_CAPTURE"
post_values.Add "x_method", "CC"
post_values.Add "x_card_num", "4111111111111111"
post_values.Add "x_exp_date", "0115"
post_values.Add "x_amount", "19.99"
post_values.Add "x_description", "Sample Transaction"
post_values.Add "x_first_name", "John"
post_values.Add "x_last_name", "Doe"
post_values.Add "x_address", "1234 Street"
post_values.Add "x_state", "WA"
post_values.Add "x_zip", "98004"
' Additional fields can be added here as outlined in the AIM integration
' guide at: http://developer.authorize.net
' This section takes the input fields and converts them to the proper format
' for an http post. For example: "x_login=username&x_tran_key=a1B2c3D4"
Dim post_string
post_string = ""
For Each Key In post_values
post_string=post_string & Key & "=" & Server.URLEncode(post_values(Key)) & "&"
Next
post_string = Left(post_string,Len(post_string)-1)
' The following section provides an example of how to add line item details to
' the post string. Because line items may consist of multiple values with the
' same key/name, they cannot be simply added into the above array.
'
' This section is commented out by default.
'
'Dim line_items(3)
'line_items(0) = "item1<|>golf balls<|><|>2<|>18.95<|>Y"
'line_items(1) = "item2<|>golf bag<|>Wilson golf carry bag, red<|>1<|>39.99<|>Y"
'line_items(2) = "item3<|>book<|>Golf for Dummies<|>1<|>21.99<|>Y"
'
'For Each item In line_items
' post_string = post_string & "&x_line_item=" & Server.URLEncode(item)
'Next
' We use xmlHTTP to submit the input values and record the response
Dim objRequest, post_response
Set objRequest = Server.CreateObject("Microsoft.XMLHTTP")
objRequest.setRequestHeader "Content-length", post_string.length
objRequest.open "POST", post_url, false
objRequest.send post_string
post_response = objRequest.responseText
Set objRequest = nothing
' the response string is broken into an array using the specified delimiting character
Dim response_array
response_array = split(post_response, post_values("x_delim_char"), -1)
' the results are output to the screen in the form of an html numbered list.
Response.Write("<OL>" & vbCrLf)
For Each value in response_array
Response.Write("<LI>" & value & " </LI>" & vbCrLf)
Next
Response.Write("</OL>" & vbCrLf)
' individual elements of the array could be accessed to read certain response
' fields. For example, response_array(0) would return the Response Code,
' response_array(2) would return the Response Reason Code.
' for a list of response fields, please review the AIM Implementation Guide
%>
</BODY>
</HTML>
09-17-2012 08:39 AM - edited 09-17-2012 08:40 AM
Can you run that with something like fiddler2, because it look to me that it is not sending any of the post values.
09-17-2012 08:58 AM - edited 09-17-2012 08:58 AM
Ah! It's working now. It had something to do with the SSL configuration. Thank you for working with me this morning.
09-17-2012 09:15 AM