Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need asp to parse data from cc authorization link

Status
Not open for further replies.

rodgerfields

Programmer
Aug 14, 2002
13
US
Friends,

I'm writing my first "e-Commerce" web site and need some help.

Existing pages have taken the customer's order and linked him up to Authorize.net, a credit card authorization system, which asks him/her for their cc information, accepts or rejects the transaction, and returns a ton of information to me.

I need to know how to grab that information so I can log it (to a text file now and to a db later). I've gotten sample code that uses WinHTTP, but it outputs the data to the other server; I need to INPUT it. (And I don't know that technology anyway!) For what it's worth,here's that code (in part). If I can use it with a few corrections, that would be fine.

=============================================

<%
'
'(snipped code builds data items for the POST)
'
' Create the object.
Set objWinHttp = Server.CreateObject(&quot;WinHttp.WinHttpRequest.5&quot;)

' Set the parameters.
objWinHttp.Open &quot;POST&quot;, &quot; & PostData

' Send it.
objWinHttp.Send

' Authorize.Net does its thing to the transaction request, and then returns the
' response string back to our object.

' Get the response string from the object.
strResponse = objWinHttp.ResponseText

'Put response string into an array.
arrResponseValues = Split(strResponse, &quot;|&quot;, -1, 1)
%>
=============================================

The data coming to me (from the credit card gateway) *is* in the form of name/value pairs. So should I use a VBScript &quot;dictionary object&quot;? If so, how do I assign it to the incoming data (or vice versa)? Does it come in as a Response object already? What?

As you can tell, I'm in over my head. But I can hack through code pretty well; I just need a push in the right direction.

Any suggestions? I'd be more than grateful.

Rodger Fields
Austin, Texas
rodger_fields@hotmail.com
Rodger Fields
Software Engineer
Pflugerville, Texas (suburb of Austin)
 
Don't know about Authorize Net but here is how this kind of thing works with Cybercash. There is a dll that is installed on the server. It is used in an ASP page by instantiating it.

Set mbResponse = Server.CreateObject(&quot;What.TheyMay.CallIt&quot;)
Set SockObj = Server.CreateObject(&quot;Socket.Thingy&quot;)
Set mbResponse = SockObj.SendMessageBlock(mbConfig, mbRequest)

The reply is available in the mbResponse object, accessed via Lookup method.

If mbResponse.Lookup(&quot;status&quot;) = &quot;failure-bad-money&quot; Then
'So sorry.
End If

Well you already know that. The real key is to obtain the Gateway API documentation from Authorize Net. To do that you will need to login to their support area. Now with Cybercash it was possible to register and obtain the documentation for free, don't know about Authorize Net. I was able to read their document just now without registering. The thing is it didn't seem to get down to the code level. And as my example above shows, it is pretty complex. Cybercash provides functional code for ASP, Perl, and C. With the code samples, the documentation makes a lot more sense if you need to extend the example.

But one would hope that you won't have to parse the response yourself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top