0
votes

I've been trying to update our API call to the CIM interface for Authorize.net to hide the Billing Address fields on the hosted profile page.

The documentation states that when call the token creation function, passing in a setting "hostedProfileBillingAddressOptions" with a value of "showNone" will hide the billing address part of the form, however when I pass in this setting I am still getting the billing address showing.

I've verified that I'm passing the setting correctly (added the same way as the "hostedProfileIFrameCommunicatorUrl" and "hostedProfilePageBorderVisible" settings) and if I pass an invalid value for the "hostedProfileBillingAddressOptions" option, the Token creation function will return an error

Is there something else that this option is dependent on, such as an account setting or another settings parameter?

For reference, I'm testing this in the Sandbox system and I'm using the dotNet SDK, my test code for calling the API function is as follows

Public Shared Function CreateHostFormToken(apiId As String, apiKey As String, branchId As Int64, nUser As Contact, iframeComURL As String) As String
        Dim nCustProfile = GetCustomerProfile(apiId, apiKey, branchId, nUser)

            Dim nHost = New AuthorizeNet.Api.Contracts.V1.getHostedProfilePageRequest()
            nHost.customerProfileId = nCustProfile

            ' Set Auth
            Dim nAuth = New Api.Contracts.V1.merchantAuthenticationType()
            nAuth.ItemElementName = Api.Contracts.V1.ItemChoiceType.transactionKey
            nAuth.name = apiId
            nAuth.Item = apiKey

            nHost.merchantAuthentication = nAuth

            ' Set Params
            Dim settingList As New List(Of Api.Contracts.V1.settingType)
            Dim nParam As New Api.Contracts.V1.settingType With {.settingName = "hostedProfileIFrameCommunicatorUrl",
                                                                 .settingValue = iframeComURL}
            settingList.Add(nParam)
            nParam = New Api.Contracts.V1.settingType With {.settingName = "hostedProfilePageBorderVisible",
                                                            .settingValue = "false"}
            settingList.Add(nParam)

            nParam = New Api.Contracts.V1.settingType With {.settingName = "hostedProfileBillingAddressOptions",
                                                            .settingValue = "showNone"}
            settingList.Add(nParam)

            nHost.hostedProfileSettings = settingList.ToArray

            Dim nX = New AuthorizeNet.Api.Controllers.getHostedProfilePageController(nHost)
            Dim nRes = nX.ExecuteWithApiResponse(GetEnvironment())

            Return nRes.token
 End Function

I've looked through the SDK code as well, and I don't see anything there that would be preventing the setting from being passed through.

Has anyone come across this issue, or successfully set the card entry form to hide the billing address?

1

1 Answers

0
votes

There turned out to be two parts to the solution to this problem:

In order to use the "hostedProfileBillingAddressOptions" option, you need to use a newer version of the capture page than I was using. I was using "https://secure2.authorize.net/profile/", while the new version is "https://secure2.authorize.net/customer/". Added bonus, the new URL provides a much nicer and modern looking form.

However, once this was working, I then had the problem that on entering the card, a validation message told me that "address and Zip code are required", despite not being visible. I did also make sure that I had the option "hostedProfileBillingAddressRequired" set to false (which is it's default value anyway)

The response from Authorize.net support is that in order to capture card without an address, the option "hostedProfileValidationMode" must be set to "testMode".

This is not mentioned in the documentation (at least as far as I could see), so may not be something that other people are aware of since it is a little counter-intuitive to use 'testMode' on a live environment. It's not ideal since validating the card for a customer account will send a transaction email to the merchant, but it seems there is not another way around this just now.

In summary, to allow the customer to add a credit card to their profile without having to provide an address, you need to specify the following options:

Form URL for capture - https://secure2.authorize.net/customer/

getHostedProfilePageRequest -

hostedProfileIFrameCommunicatorUrl: *your URL*
hostedProfilePageBorderVisible: false  //assuming you are using an iFrame
hostedProfileValidationMode: testMode
hostedProfileBillingAddressOptions: showNone