I have just started a new form in Visual Basic. I have the Authorize.Net dll as a reference and my
New CardPresentAuthorizationRequest is importing correctly. However, I am getting a error with the New CardPresentGateway which is suppose to take mulitple arguments. Overload failed is the error. Any ideas?
Thanks, Tim
Solved! Go to Solution.
12-15-2012 11:35 PM
Thanks you all for the help on this! I went ahead and set up a test account and discovered he answer to my last post. Thanks again!
Tim
12-16-2012 10:55 PM
Hello again.
This is an old thread of mine and thought I would add here.
I am still using the New CardPresentAuthorizationRequest.
I have not signed up for an account so I am still using the sandbox. These transactions are in Authorized/Pending Capture and Refund/Pending Settlement. Does my software still have to capture these?
Should it be done in the same transaction or if it needs to be submitted is a batch the best way. I would rather not need to send a batch afterward.
Thanks!
Tim
03-05-2014 01:34 PM
I apoplogize. I found that the code was needing 5 arguments. The code snip from your site was only using 2. Could you please tell what the 5 arguments Thanks!
Tim
12-15-2012 11:45 PM
One more point. This line is erroring.
Dim response = (CardPresentResponse)gate.Send(req)
First, I don't think the variable is req, but request. It is erroring with "End of statement expected". I am not sure what it is asking for.
Thanks,
Tim
12-15-2012 11:51 PM
First, I don't think the variable is req, but request.
Since you define what the variable name is I not sure what it is either.
Dim response = (CardPresentResponse)gate.Send(req) It is erroring with "End of statement expected". I am not sure what it is asking for.
I don't think you can do (CardPresentResponse) just like C#.
http://www.harding.edu/fmccown/vbnet_csharp_comparison.html
c = DirectCast(s, Circle)
12-16-2012 03:53 AM
Hey!
I think I see what the suggetion is. I tried this and still get errors:
Dim response = New CardPresentResponse(gate, request)
and
Dim response = New CardPresentResponse(request, gate)
These are not correct either.
But, this does not error:
Dim response = gate.Send(request)
This is the code I am started with:
Dim request = New CardPresentAuthorizationRequest("10.00M", "%B4111111111111111^CARDUSER/JOHN^1803101000000000020000831000000?", ";4111111111111111=1803101000020000831?")
Dim gate = New CardPresentGateway("YOUR_API_LOGIN_ID", "YOUR_TRANSACTION_KEY", "", "", "")
Dim response = (CardPresentResponse)gate.Send(req) ///This code is erroring
Console.WriteLine("{0}: {1}", response.ResponseCode, response.Message)
Console.Read()
Any ideas?
Tim
12-16-2012 12:16 PM
I just tried debugging and having a failure. This is the error.
Warning 1 The referenced assembly "AuthorizeNet" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. Authorize.Net
It removed the dll also.
Tim
12-16-2012 12:30 PM
Warning 1 The referenced assembly "AuthorizeNet" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. Authorize.Net
Change your project to framework 4 instead of framework 4 client.
using C# to vb.net
http://www.developerfusion.com/tools/convert/csharp-to-vb/
Dim response = DirectCast(gate.Send(req), CardPresentResponse)
why don't you use the 3 params for CardPresentGateway?
if you pass blank for marketType, and deviceType, it probably going to fail.
12-16-2012 01:49 PM
Hey!
The response line is right! Thanks.
I switched the framework and still got the error though. I also selected both and got the error.
Also, its erroring saying it is looking for a use of a Namespace. The code i wrote was on a button handle. If I surround the form in Namespace, the button hanle is errotring.
Warning 2 Namespace or type specified in the Imports 'AuthorizeNet' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. F:\Visual Basic\Authorize.Net\Authorize.Net\Form1.vb 5 9 Authorize.Net.
Also, I can remove those params and NOT get an error. Thanks!
This is now the code:
NameSpace SampleAuthorization
PublicClass Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim request = NewCardPresentAuthorizationRequest("10.00M", "%B4111111111111111^CARDUSER/JOHN^1803101000000000020000831000000?", ";4111111111111111=1803101000020000831?")
Dim gate = NewCardPresentGateway("YOUR_API_LOGIN_ID", "YOUR_TRANSACTION_KEY", "")
Dim response = DirectCast(gate.Send(request), CardPresentResponse)
Console.WriteLine("{0}: {1}", response.ResponseCode, response.Message)
Console.Read()
End Sub
End Class
End Namespace
Tim
12-16-2012 03:35 PM
Here is my step, create a new vb.net "Windows Forms Application"
Add referenece of the AuthorizeNet.dll
go into to the project properties - compile -"advanced compile options"
change the "Target framework" to: .NET framework 4
now go to the winform Form1, add a button and a label. and just double click the button and add the code in to the Click event and add the imports authorizenet. like the following.
Imports AuthorizeNet
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim request = New CardPresentAuthorizationRequest(10.0, "%B4111111111111111^CARDUSER/JOHN^1803101000000000020000831000000?", ";4111111111111111=1803101000020000831?")
Dim gate = New CardPresentGateway("YOUR_API_LOGIN_ID", "YOUR_TRANSACTION_KEY", True)
Dim response = DirectCast(gate.Send(request), CardPresentResponse)
Label1.Text = String.Format("{0}: {1}", response.ResponseCode, response.Message)
End Sub
End Class
12-16-2012 04:17 PM
Hey hey!!
I thank you! I couldn't locate that change. I knew where to change the prerequisites!
It is clear of errors now.
Tim
12-16-2012 05:32 PM