Braintree Sandbox API 上的突然失败请求:“账单状态格式无效”

时间:2021-01-13 11:29:04

标签: braintree braintree-sandbox

我们正在经营一家与 Braintree 相连的英国 Magento 商店。几个月来,一切都在顺利运行,但突然之间,我们无法再在连接到 Braintree 沙盒的任何临时或本地测试环境中完成订单。

在结账时,会向 3d 安全端点发出请求,如果我们进入了位于英国的县,我们会收到以下响应:

端点: https://api.sandbox.braintreegateway.com/merchants/xxx/client_api/v1/payment_methods/xxx/three_d_secure/lookup

请求计费部分:

"additionalInfo": {
        "billingCity": "Leeds",
        "billingCountryCode": "GB",
        "billingGivenName": "John",
        "billingLine1": "50 Upton Road",
        "billingPhoneNumber": "07733222111",
        "billingPostalCode": "LE6 7TH",
        "billingState": "Yorkshire",
        "billingSurname": "Smith"
    },

回复:

{
    "error": {
        "message": "Billing state format is invalid."
    },
    "threeDSecureInfo": {
        "liabilityShiftPossible": false,
        "liabilityShifted": false
    }
}

如果我们从结帐中删除县字段(并最终从请求中删除“billingSate”),则响应有效并且我们能够正常结帐。

  • 这种情况最近才开始发生
  • 相同的代码库在生产 Braintree 上运行良好
  • 我在生产中使用完全相同的参数模拟了一个请求,它运行正常
  • 向 Braintree 提出请求,但没有回应
  • 如果我在县字段中使用两位数的美国州代码,我就可以结帐

有人有什么想法吗?

2 个答案:

答案 0 :(得分:4)

我终于从 Braintree 那里得到了关于这个的答案。显然 3ds2 现在已在 Sandbox 上强制执行,这要求将州或县作为两位数代码发送。

在生产中,如果发送全名,它将(当前)优雅地降级为 3ds1 并完成。

为了促使人们使用 3ds2,沙盒没有切换到 3ds1 并返回错误。

答案 1 :(得分:1)

今天我在 Braintree 中遇到了同样的 3DSecure 问题。 首先,我确保我使用的是最新版本的插入、客户端和数据收集器脚本,这些脚本(在撰写此回复时)是:

<script src="https://js.braintreegateway.com/web/3.71.0/js/client.min.js"></script>
<script src="https://js.braintreegateway.com/web/3.71.0/js/data-collector.min.js"></script>
<script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js"></script>

然后我修改/重命名了两个“threeDSecure”属性“locality”->“city”和“region”->“state”

dropin.requestPaymentMethod({
            threeDSecure: {
                amount: '10.01',
                email: 'me@mydomain.com',
                billingAddress: {
                    givenName: 'John',
                    surname: 'Smith',
                    streetAddress: '51 East Street,
                    extendedAddress: 'na',
                    city: 'Colchester',
                    state: 'Essex',
                    postalCode: 'CO1 2QY',
                    countryCodeAlpha2: 'GB'
                }
            }
        }, function (err, payload) {
            if (err) {
                console.log('tokenization error:');
                dropin.clearSelectedPaymentMethod();     
                return;
            }

            if (!payload.liabilityShifted) {
                console.log('Liability did not shift');
                return;
            }

                console.log('verification success');
                console.log(payload.nonce);
        });

我希望这对您有所帮助,因为它在沙盒环境中对我来说效果很好。