We are converting from the soap endpoints to using the API and I'm having issues with the call to getHostedProfilePageRequest(). We are trying to set some settings and they are being rejected with the following two messages:
From what I can from the documentation, these settings are definitely valid for the method. Here is my code:
Dim settings() As AuthorizeNet.Api.Contracts.V1.settingType = New AuthorizeNet.Api.Contracts.V1.settingType(1) {} settings(0) = New AuthorizeNet.Api.Contracts.V1.settingType() settings(0).settingName = settingNameEnum.hostedProfilePageBorderVisible settings(0).settingValue = False settings(1) = New AuthorizeNet.Api.Contracts.V1.settingType() settings(1).settingName = settingNameEnum.hostedProfileIFrameCommunicatorUrl settings(1).settingValue = communicatorURL Dim request As New AuthorizeNet.Api.Contracts.V1.getHostedProfilePageRequest() request.customerProfileId = authorizeProfileID request.hostedProfileSettings = settings Dim controller As New getHostedProfilePageController(request) controller.Execute() Dim response As AuthorizeNet.Api.Contracts.V1.getHostedProfilePageResponse = controller.GetApiResponse()
The response contains the two messages. The "communicatorURL" starts with "https://..."
Why is it not accepting these settings for the getHostedProfilePageRequest method??
Solved! Go to Solution.
01-03-2019 02:35 PM
I figured it out. I needed to .ToString the settingNameEnum's as it was assigning the numeric value to the setting.Name which needed to be the string. Here is the working code:
Dim settings() As AuthorizeNet.Api.Contracts.V1.settingType = New AuthorizeNet.Api.Contracts.V1.settingType(1) {} settings(0) = New AuthorizeNet.Api.Contracts.V1.settingType() settings(0).settingName = settingNameEnum.hostedProfilePageBorderVisible.ToString() settings(0).settingValue = "false" settings(1) = New AuthorizeNet.Api.Contracts.V1.settingType() settings(1).settingName = settingNameEnum.hostedProfileIFrameCommunicatorUrl.ToString() settings(1).settingValue = communicatorURL Dim request As New AuthorizeNet.Api.Contracts.V1.getHostedProfilePageRequest() request.customerProfileId = authorizeProfileID request.hostedProfileSettings = settings Dim controller As New getHostedProfilePageController(request) controller.Execute() Dim response As AuthorizeNet.Api.Contracts.V1.getHostedProfilePageResponse = controller.GetApiResponse()
01-03-2019 02:41 PM
I figured it out. I needed to .ToString the settingNameEnum's as it was assigning the numeric value to the setting.Name which needed to be the string. Here is the working code:
Dim settings() As AuthorizeNet.Api.Contracts.V1.settingType = New AuthorizeNet.Api.Contracts.V1.settingType(1) {} settings(0) = New AuthorizeNet.Api.Contracts.V1.settingType() settings(0).settingName = settingNameEnum.hostedProfilePageBorderVisible.ToString() settings(0).settingValue = "false" settings(1) = New AuthorizeNet.Api.Contracts.V1.settingType() settings(1).settingName = settingNameEnum.hostedProfileIFrameCommunicatorUrl.ToString() settings(1).settingValue = communicatorURL Dim request As New AuthorizeNet.Api.Contracts.V1.getHostedProfilePageRequest() request.customerProfileId = authorizeProfileID request.hostedProfileSettings = settings Dim controller As New getHostedProfilePageController(request) controller.Execute() Dim response As AuthorizeNet.Api.Contracts.V1.getHostedProfilePageResponse = controller.GetApiResponse()
01-03-2019 02:41 PM