Need a little help with adding fingerprint code to asp classic (vb and javascript) code. Getting type mismatch error when processing test trans at www.ccgintl2.com/ncmalasb2/ Processing is in the subroutine which follows:
'THis is the subroutine for sending transactons to the Authorize.Net gateway Private Sub processCCAuthNet() On Error Resume Next Dim obj Dim request_string Dim response_string Response.Write("Got to ProcessCCAuthNet") ' create the PNCOMClient component 'Set client = Server.CreateObject("PFProCOMControl.PFProCOMControl.1") 'Set obj = Server.CreateObject("Microsoft.XMLHTTP")' used for Interland site Set obj = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0") ' used for GoDaddy site If Err.Description <> "" Then Response.Write("Error at Set client:" & Err.Description & "<br>") End If 'This is the asp for authorize.net 'Create the fingerprint using the MD5 security algorithm x_login = "4Q69bKsD" If Err.Description <> "" Then Response.Write("Login Value: " & x_login & "<br>") Response.Write("Error at Login:" & Err.Description & "<br>") End If x_fp_sequence = treqnum If Err.Description <> "" Then Response.Write("Sequence Value: " & x_fp_sequence & "<br>") Response.Write("Error at Sequence Num:" & Err.Description & "<br>") End If x_fp_timestamp = CStr(Now()) If Err.Description <> "" Then Response.Write("Timestamp Value: " & x_fp_timestamp & "<br>") Response.Write("Error at Timestamp:" & Err.Description & "<br>") End If x_amount = tordertotal If Err.Description <> "" Then Response.Write("Amount Value: " & tordertotal & "<br>") Response.Write("Error at Amount" & Err.Description & "<br>") End If x_transkey = "39jJ9aa87JH83f5p" If Err.Description <> "" Then Response.Write("Transkey Value: " & x_transkey & "<br>") Response.Write("Error at Login:" & Err.Description & "<br>") End If fingerprint = HMAC-MD5 ("x_login^x_fp_sequence^x_fp_timestamp^x_amount^","x_transkey") 'Fingerprint = HMAC-MD5 ("authnettest^789^67897654^10.50^","abcdefgh12345678") If Err.Description <> "" Then Response.Write("Fingerprint Value:" & fingerprint & "<br>") Response.Write("Error at Fingerprint:" & Err.Description & "<br>") End If x_fp_hash = CStr(fingerprint) 'edit the parameters to be transmitted to assure that they do not exceed the permitted length and are the correct data type tempzip=tbillingzip tempzip=Replace (tempzip,"-","") tempzip=Replace (tempzip," ","") If Not IsNumeric(tempzip) Then temp = "0" End If If Len(tempzip) > 9 Then tempzip = Left(tempzip,9) End If If Len(acctname) > 128 Then acctname = Left(acctname,128) End If If Len(tname) > 128 Then tname = Left(tname,128) End If If Len(tbillname) > 128 Then tbillname = Left(tbillname,128) End If If Len(tcompany) > 30 Then tcompany = Left(tcompany,30) End If If Len(tbillingfirstname) > 15 Then tbillingfirstname = Left(tbillingfirstname,15) End If If Len(tbillinglastname) > 15 Then tbillinglastname = Left(tbillinglastname,15) End If If Len(taddr1) > 30 Then taddr1 = Left(taddr1,30) End If 'build the parameter list, such that we have a sale transaction and 'a credit card tender. request_string="4Q69bKsD" 'This is the Test API Key request_string=request_string & "&" & "39jJ9aa87JH83f5p" 'THis is the Test Transaction Key request_string=request_string & "&" & "x_fp_hash=" & fingerprint request_string=request_string & "&" & "x_first_name=" & tbillingfirstname request_string=request_string & "&" & "x_last_name=" & tbillinglastname request_string=request_string & "&" & "x_address=" & tbillingaddr1 request_string=request_string & "&" & "x_city=" & tbillingcity request_string=request_string & "&" & "x_state=" & tbillingstate request_string=request_string & "&" & "x_zip=" & tbillingzip request_string=request_string & "&" & "x_country=US" request_string=request_string & "&" & "x_email=" & temailaddr request_string=request_string & "&" & "x_card_num=" & tccnumber request_string=request_string & "&" & "x_exp_date=" & tccexpiremonth & tccexpireyear 'request_string=request_string & "&" & "T_code=01" request_string=request_string & "&" & "x_amount=" & tordertotal If Err.Description <> "" Then Response.Write("Error b4 obj.Open:" & Err.Description & "<br>") End If obj.Open "POST","https://test.authorize.net/gateway/transact.dll?transaction",False If Err.Description <> "" Then Response.Write("Error after obj.Open:" & Err.Description & "<br>") End If obj.Send request_string If Err.Description <> "" Then Response.Write("Error after obj.Send:" & Err.Description & "<br>") End If response_string=obj.responseText If Err.Description <> "" Then Response.Write("Error after response.string=:" & Err.Description & "<br>") End If 'Response.Write("Full Packet Response=" & response_string & "<br>") tccresult=mid(response_string,2,1) 'Response.Write("tccresult=" & tccresult & "<br>") tccrespmsg=mid(response_string,9,32) 'Response.Write("tccrespmsg=" & tccrespmsg & "<br>") tccpnref=mid(response_string,47,10) 'Response.Write("tccrespmsg=" & tccrespmsg & "<br>") tccauthcode=mid(response_string,3,6) End Sub
Hi,
We do provide legacy sample code for ASP classic on our download page, but we are no longer updating this sample. I would recommend taking a look to see if it works for you or gives you a hint about solving the type error.
Thanks,
Joy
09-09-2013 12:54 PM