I am evaluating Authorize.Net as a likely solution for initial and re-curing billing for my Saas application. I have been putting together a proof of concept for my manager. It is an ASP.Net WinForms app. I have been following the examples from the csharp_cim and hostedProfileManage downloads. Also with help from the documentation I've been able to get most everything working in a suprisingly small amount of time. I am however having an issue getting the pop-up to display the users profile to enter payment options. I have implemented it per the hostedProfileManage example and I am generating the token per the csharp_cim example. When the popup displays it gives me the error "Missing or invalid token." I have verified that the token is populated in the hidden form per the example and that the token is recently generated. I noticed that the token that I get is about half as long as the token that was pre-populated in the example, I'm not sure if that's normal.
Any advise you can offer will be greatly appreciated.
Solved! Go to Solution.
11-09-2011 02:28 PM
Question. So you did uncomment the line?
AuthorizeNetPopup.options.useTestEnvironment = true;
2. Have you debug the getToken and copy and paste the result to the examplePage.html?
3. Make sure there is no space between the double quote for the Token hidden field.
It work for me with your code. I copied your code to the sample code for C# soap cim. Updated the web reference, call your method with my test loginID, Key and custprofid. and copy and paste the resp.token to the examplePage.html and uncomment the usetestenvironment = true line. Run the html in IE and it work.
11-10-2011 08:52 AM
Since the token required the loginID and transactionKey. Maybe it enter wrong? or it try to get it from the wrong URL(sandbox vs production)?
11-10-2011 04:32 AM
Here is the code that I am using. It seems to work correctly. I get a response code OK and a token returns. I steped through the javascript to ensure that it is setting:
form.action = "https://test.authorize.net/profile/"+ opt.action;
and that the value of hdnToken in the form is set to what was returned by the GetToken function.
opt.action is set to "manage".
private string GetToken(long custProfId ) { CustomerProfileWS.Service service = new CustomerProfileWS.Service(); service.Url = "https://apitest.authorize.net/soap/v1/Service.asmx"; CustomerProfileWS.MerchantAuthenticationType auth = new CustomerProfileWS.MerchantAuthenticationType(); auth.name = "MY_API_LOGIN_ID"; auth.transactionKey = "MY_TRANSACTION_KEY"; CustomerProfileWS.GetHostedProfilePageResponseType resp = service.GetHostedProfilePage(auth, custProfId, null); if (resp.resultCode == AuthorizeNetSandbox.CustomerProfileWS.MessageTypeEnum.Ok) { return resp.token; } else { foreach (CustomerProfileWS.MessagesTypeMessage message in resp.messages) System.Diagnostics.Debug.WriteLine(string.Format("[Code: {0}] {1}", message.code, message.text)); } return string.Empty; }
Any additional help will be greatly appreciated.
11-10-2011 06:59 AM
Question. So you did uncomment the line?
AuthorizeNetPopup.options.useTestEnvironment = true;
2. Have you debug the getToken and copy and paste the result to the examplePage.html?
3. Make sure there is no space between the double quote for the Token hidden field.
It work for me with your code. I copied your code to the sample code for C# soap cim. Updated the web reference, call your method with my test loginID, Key and custprofid. and copy and paste the resp.token to the examplePage.html and uncomment the usetestenvironment = true line. Run the html in IE and it work.
11-10-2011 08:52 AM
Forgot to tell you, the token I got is shorter than the one in the examplePage.html.
11-10-2011 09:13 AM - edited 11-10-2011 09:13 AM
Run a few more test. space before and after in the token field didn't cause an error. Did you change the letter case in token? or remove char like the forward slash "/"?
11-10-2011 09:47 AM - edited 11-10-2011 09:48 AM
I hadn't tried copying the token into the examplepage.html. That worked. This tells me that I must have not copied something correctly from the example page to my application. Thank you so much for the suggestion!
11-10-2011 09:53 AM