Reply
Highlighted
Member
Posts: 5
Registered: ‎01-03-2019
Accepted Solution

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


Accepted Solutions
Solution
Accepted by topic author jfkrueger
‎01-03-2019 02:41 PM
Member
Posts: 5
Registered: ‎01-03-2019

Re: Retrieve token using API

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


All Replies
Solution
Accepted by topic author jfkrueger
‎01-03-2019 02:41 PM
Member
Posts: 5
Registered: ‎01-03-2019

Re: Retrieve token using API

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