Reply
Member
Posts: 1
Registered: ‎06-14-2012

Trouble Understanding ASP.NET objects

I just recently started using Authorize.Net to submit our website's payments.  I am implementing this through the Advanced Integration Method using ASP.Net.

 

So, I have the SDK downloaded and am able to submit some sample transactions via my dev account ... but it seems that some of the Authorize.net objects are half-baked ... or I'm just not aware of how to correctly use them (hoping for some enlightenment from you guys)

 

For example ... to create a request object, the sample shows this:

 

Dim request As New AuthorizationRequest("4007000000027", "1214", 10.0, "Test Transaction #1")

 

Which is fine, but why doesn't this work?

 

Dim request As New AuthorizeNet.AuthorizationRequest()    *** THIS LINE OF CODE IS INVALID
request.CardNum = "4007000000027"
request.CardCode = "123"
request.ExpDate = "1214"
request.Amount = 10.0
request.Description = "test transaction #1234"

request.Type = "AUTH_ONLY"

 

It doesn't work, because you can't instantiate without any variables.  So, I'm very confused as to why the object lets me interact via its properties, but forces me to create it with parameter values I could "load" later.  This seem very odd to me.

 

Next question ... Customer information ....

 

the sample shows me doing it this way:

 

request.AddCustomer("john123", "John", "Smith", "123 Main St", "CA", "90201")

 

Instead of using the objects it has built in ... like this:

 

Dim cust As New AuthorizeNet.Customer
cust.Email = "johnsmith@gmail.com"
cust.ID = "john123"
Dim address As New AuthorizeNet.Address
address.ID = "john123"
address.First = "John"
address.Last = "Smith"
address.Street = "123 Main St."
address.City = "Beverly Hills"
address.State = "CA"
address.Zip = "90201"
address.Phone = "212.555.1000"

cust.BillingAddress = address              *** THIS LINE OF CODE IS INVALID

and this one too:

cust.BillingAddress.Add(address)           *** THIS LINE OF CODE IS INVALID


Am I missing something?  Is there any use for some of the objects (like customer or address) ... Or should I just be using all these listed fields like x_amount, x_exp_date, etc?  These don't seem to be right when doing this in OOProgramming.

 

LAST QUESTION:

What field is the Response Reason Code in?  I found the Response Code:

 

Dim response As AuthorizeNet.GatewayResponse = gate.Send(request)

Dim respcode =  response.ResponseCode 

 

 

Thanks in advance,
Nate 


Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Trouble Understanding ASP.NET objects

My advice is to download the source code and modify it to fit you.