cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve token using API

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:

 

  1. "Setting Name '10' is invalid for this method."
  2. "Setting Name '11' is invalid for this method."

 

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??

jfkrueger
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

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()

View solution in original post

jfkrueger
Contributor
1 REPLY 1

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()
jfkrueger
Contributor