I figured this out and the hosted CIM popup page is showing up.
Here's the code which is currently returning the token:
/// <summary>
/// Gets the hosted profile page token.
/// </summary>
/// <param name="customerProfileId">The customer profile identifier.</param>
/// <returns></returns>
public static StatusWithData<string> GetHostedProfilePageToken(long customerProfileId)
{
ILog log = LogManager.GetLogger(typeof(AuthorizeNetHelper));
try
{
SettingType[] settings = new SettingType[0];
GetHostedProfilePageResponseType response = SoapAPIUtilities.Service.GetHostedProfilePage(SoapAPIUtilities.MerchantAuthentication, customerProfileId, settings);
bool isSuccess = response != null && response.resultCode == MessageTypeEnum.Ok;
return isSuccess
? new StatusWithData<string> {Success = true, Data = response.token, Messages = new List<string>()}
: new StatusWithData<string> {Success = false, Messages = new List<string> {"Error: unable to retrieve hosted profile page token from auth.net"}};
}
catch (Exception ex)
{
string msg = string.Format("Error: unhandled exception in AuthorizeNetHelper.GetHostedProfilePageToken. {0}", ex.Message);
log.Error(msg, ex);
return new StatusWithData<string> {Success = false, Messages = new List<string> {msg}};
}
}
I utilized the "CIM - hosted popu..." sample to determine how to integrate the JavaScript, etc. into my ASP.NET MVC application (Auth.net sample code).
The only part that I still need to solve is more seemlessly integrating this into my web site and how to eliminate the address information, since at this point the client only wants to store the cardholder data on auth.net. I am hoping that the hosted CIM page code is flexible enough to let me control some of the client presentation (UX).
If anyone has some pointers on how to display the hosted CIM page as an embeded asset instead of a pop up, please reply to this message thread.
Thanks,
Martin