- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The authnet .NET SDKs do not have any examples of the GetHostedProfilePage API call. I'm having trouble building this from scratch because I'm working directly with the soap proxy in VS. Does anyone have a working example of how to call GetHostedProfilePage from within the Visual Studio .NET SDK?
So far this is what I've strung together, but it's not working at all:
public string GetHostedProfilePage(string apiLogin, string transactionKey, string customerProfileID) { AuthNetAPITest.MerchantAuthenticationType merchant = new AuthNetAPITest.MerchantAuthenticationType(); merchant.name = apiLogin; merchant.transactionKey = transactionKey; AuthNetAPITest.GetHostedProfilePageRequest request = new AuthNetAPITest.GetHostedProfilePageRequest(merchant, long.Parse(customerProfileID), null); AuthNetAPITest.GetHostedProfilePageResponseType responseType = new AuthNetAPITest.GetHostedProfilePageResponseType(); AuthNetAPITest.GetHostedProfilePageResponse response = new AuthNetAPITest.GetHostedProfilePageResponse(responseType); string token = response.GetHostedProfilePageResult.token; var resultCode = responseType.resultCode; return token; }
I don't get any errors, I just get back null for all the response object properties. Please help. Thanks!
Solved! Go to Solution.
01-05-2012 06:20 AM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure why the example 1 didn't work, It based on the updated web reference from the c# sample code from http://developer.authorize.net/downloads/samplecode/ .
example 2 was based on how SDKs usually call a web service, I through that what you are trying to do.
This is using "service reference" not the web reference on vs2010. Basically the same as example 1, except it call ServiceSoapClient to create the object. If this still don't work for you, don't know what else to do cause both 1 and this work for me.
public string GetHostedProfilePage(string apiLogin, string transactionKey, string customerProfileID) { AuthNetAPITest.MerchantAuthenticationType merchant = new AuthNetAPITest.MerchantAuthenticationType(); merchant.name = apiLogin; merchant.transactionKey = transactionKey; AuthNetAPITest.ServiceSoapClient _ssc = new AuthNetAPITest.ServiceSoapClient(); AuthNetAPITest.GetHostedProfilePageResponseType responseType = _ssc.GetHostedProfilePage(merchant, long.Parse(customerProfileID), null); string token = responseType.token; var resultCode = responseType.resultCode; return token; }
01-07-2012 01:47 PM - edited 01-07-2012 01:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the provided popup.js I believe this line has to be uncommented: AuthorizeNetPopup.options.useTestEnvironment=true;
01-11-2012 05:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CustomerProfileWS.Service service = new CustomerProfileWS.Service(); service.Url = "https://apitest.authorize.net/soap/v1/Service.asmx"; CustomerProfileWS.MerchantAuthenticationType auth = new CustomerProfileWS.MerchantAuthenticationType(); auth.name = YOUR_ID; auth.transactionKey = YOUR_KEY; CustomerProfileWS.GetHostedProfilePageResponseType resp = service.GetHostedProfilePage(auth, custProfId, null); if (resp.resultCode == 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;
It based on the C# CIM sample code with updated web reference.
01-05-2012 06:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are using the SDK,
It usually is something like
var response = (GetHostedProfilePageResponse)_gateway.Send(request);
01-05-2012 06:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your posts, but neither are helpful. Your 1st post was essentially a copy of what I already posted, that doesn't work, except that you changed the name of the proxy object. Your 2nd post is not valid because it won't compile. The GetHostedProfilePageResponse class does not exist in the SDK. It does exist in the proxy web service call, but this is an invalid cast with _gateway.
I don't wish to sound mean, but it seems you posted these 2 comments without carefully reading the problem, and the posts were not helpful. I can tell you're knowledgeable about this stuff and I would loving getting a bit more help.
Could you please either:
1- post a working code sample that actually works with the .NET SDK
or
2- give me a working example of ANY api call that calls authnet web service - if I can see how to sort out the xxxResponse and xxxRequest calls, that would be great.
Thanks!!
01-07-2012 10:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I looked around and couldn't find an API example for the PHP API, which is what I used. Apparently it's well-hidden. But here's XML, you could theoretically just pass that and parse the result if all else fails:
Send:
<?xml version="1.0" encoding="utf-8"?> <getHostedProfilePageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <merchantAuthentication> <name>YourUserLogin</name> <transactionKey>YourTranKey</transactionKey> </merchantAuthentication> <customerProfileId>YourProfileID</customerProfileId> <hostedProfileSettings> <setting> <settingName>hostedProfileReturnUrl</settingName> <settingValue>https://blah.com/blah/</settingValue> </setting> <setting> <settingName>hostedProfileReturnUrlText</settingName> <settingValue>Continue to blah.</settingValue> </setting> <setting> <settingName>hostedProfilePageBorderVisible</settingName> <settingValue>true</settingValue> </setting> </hostedProfileSettings> </getHostedProfilePageRequest>
Response:
<?xml version="1.0" encoding="utf-8"?> <getHostedProfilePageResponse xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <messages> <resultCode>Ok</resultCode> <message> <code>I00001</code> <text>Successful.</text> </message> </messages> <token>+ZeWDaUOPoQPRGTHcKd7DYbMfcAFDrhO8GPOFNt+ACzJnvkz+aWO0SYSAA9x602jAI KKfUHUt2ybwQRaG8LzHluuR5dRgsuh+kjarKvD0hpieGjLHmnz0LHmFv1Xe9P3zpmawqBCSB/ d4jcSg9dAxecNBUzMwIuYzY+vGUGLUXgr9QPaRh93HqWZrV4Mbwop</token> </getHostedProfilePageResponse>
This is from the CIM XML guide, incidently.
01-07-2012 11:48 AM - edited 01-07-2012 11:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure why the example 1 didn't work, It based on the updated web reference from the c# sample code from http://developer.authorize.net/downloads/samplecode/ .
example 2 was based on how SDKs usually call a web service, I through that what you are trying to do.
This is using "service reference" not the web reference on vs2010. Basically the same as example 1, except it call ServiceSoapClient to create the object. If this still don't work for you, don't know what else to do cause both 1 and this work for me.
public string GetHostedProfilePage(string apiLogin, string transactionKey, string customerProfileID) { AuthNetAPITest.MerchantAuthenticationType merchant = new AuthNetAPITest.MerchantAuthenticationType(); merchant.name = apiLogin; merchant.transactionKey = transactionKey; AuthNetAPITest.ServiceSoapClient _ssc = new AuthNetAPITest.ServiceSoapClient(); AuthNetAPITest.GetHostedProfilePageResponseType responseType = _ssc.GetHostedProfilePage(merchant, long.Parse(customerProfileID), null); string token = responseType.token; var resultCode = responseType.resultCode; return token; }
01-07-2012 01:47 PM - edited 01-07-2012 01:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Raynor,
Thank you!! That did the trick. I've got this working great...but now when I try to load the lightbox with the hosted page I keep getting the error "Customer Information Manager is not enabled.". Some google searches on this revealed that this is a very common problem. Do you know what I'm doing wrong? It seems to me that CIM is enabled in my sandbox (else how could I successfully create CIM customers??). I checked all my settings, everything seems right. But I must be missing something.
I'm posting to this test URL: https://test.authorize.net/hosted/profile/manage
Please help.
01-10-2012 09:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sandbox accounts come with almost everything, while production accounts need CIM turned on for it to work, since there's an additional monthly fee involved. If I remember correctly, you set that up by going into your account to Account -> User Profile and then maybe Edit Profile Information.
EDIT: I'm sure you know that the production account will not work through the test URL, right?
01-10-2012 11:47 PM - edited 01-10-2012 11:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the provided popup.js I believe this line has to be uncommented: AuthorizeNetPopup.options.useTestEnvironment=true;
01-11-2012 05:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
nic73,
You're right! That did the trick and now I'm in business. Thanks so much.
01-14-2012 07:39 AM