0

我一直在尝试更新我们对 Authorize.net 的 CIM 接口的 API 调用,以隐藏托管配置文件页面上的帐单地址字段。

文档指出,当调用令牌创建函数时,传入值为“showNone”的设置“hostedProfileBillingAddressOptions”将隐藏表单的帐单地址部分,但是当我传入此设置时,我仍然得到显示的帐单地址.

我已验证我正确传递了设置(添加方式与“hostedProfileIFrameCommunicatorUrl”和“hostedProfilePageBorderVisible”设置相同),如果我为“hostedProfileBillingAddressOptions”选项传递了无效值,令牌创建函数将返回错误

此选项是否依赖于其他内容,例如帐户设置或其他设置参数?

作为参考,我在沙盒系统中测试,我使用的是dotNet SDK,我调用API函数的测试代码如下

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

我也查看了 SDK 代码,我没有看到任何会阻止设置通过的内容。

有没有人遇到过这个问题,或者成功设置了卡片输入表单来隐藏账单地址?

4

1 回答 1

0

原来有两个部分来解决这个问题:

为了使用“hostedProfileBillingAddressOptions”选项,您需要使用比我使用的更新版本的捕获页面。我使用的是“ https://secure2.authorize.net/profile/ ”,而新版本是“ https://secure2.authorize.net/customer/ ”。额外的好处是,新的 URL 提供了一个更漂亮、更现代的表单。

然而,一旦这个工作正常,我就会遇到一个问题,即在输入卡时,一条验证消息告诉我“需要地址和邮政编码”,尽管不可见。我还确保将“hostedProfileBillingAddressRequired”选项设置为false(无论如何这是默认值)

Authorize.net 支持的响应是,为了捕获没有地址的卡,必须将选项“hostedProfileValidationMode”设置为“testMode”。

文档中没有提到这一点(至少据我所知),因此其他人可能不知道,因为在实时环境中使用“testMode”有点违反直觉。这并不理想,因为验证客户帐户的卡会向商家发送交易电子邮件,但目前似乎没有其他方法可以解决这个问题。

总之,要允许客户在不提供地址的情况下将信用卡添加到他们的个人资料中,您需要指定以下选项:

用于捕获的表单 URL - https://secure2.authorize.net/customer/

getHostedProfilePageRequest -

hostedProfileIFrameCommunicatorUrl: *your URL*
hostedProfilePageBorderVisible: false  //assuming you are using an iFrame
hostedProfileValidationMode: testMode
hostedProfileBillingAddressOptions: showNone
于 2016-08-27T10:57:02.417 回答