如何使用 BrainTree 对存储在 Vault 中的卡进行 3D 安全交易 API

How to Proceed 3D Secure transactions for cards that are stored in Vault using BrainTree API

我已经尝试将 braintree API 放入我的 Dotnet webform 应用程序中,并且能够成功创建事务。现在我陷入了为存储在 Braintree Vault 中的卡片设置交易以进行 3D 安全验证的问题之一。

在API中,他们提到通过服务器的随机数和来自客户端的金额来验证交易。但是我无法得到 link。我在访问责任转移概念时也非常困惑。我能对此有更好的解释吗?

我已经非常彻底地完成了 API 但无法弄清楚这个问题。

我的要求:我需要在我的应用程序中为支持 3D 安全的卡创建 3DSecure 交易。如果客户没有启用 3D 安全,我应该能够完成交易。(我通过将 3D Secure - Required 属性从服务器端传递到 false 来理解这一点) 现在我还需要将卡片详细信息保存在 Vault for Saved Cards 部分。因此,当我尝试调用 3DSecure for Saved cards 部分时,从客户端生成的 response.nonce 与在服务器端生成的 Nonce 相同。所以它说 NONCE 已经使用。

所以请在这方面帮助我。提前致谢。

斯里坎特

我在 Braintree 担任开发人员。如果您的服务器端和客户端代码是 integrated properly,则客户端上 verify3DS() 方法返回的随机数应该与服务器上最初生成的随机数不同。

服务器端:使用支付方式的令牌在您的服务器上生成支付方式随机数。

// Generate a nonce for the payment method on your server

var result = gateway.PaymentMethodNonce.Create("PaymentMethodToken");
var nonce = result.Target.Nonce;

注意:我正在努力在我们的 documentation 中包含这样的代码片段,以防止将来对如何在服务器上生成随机数产生混淆。

客户端:使用来自服务器的随机数来验证卡。然后使用客户端的随机数完成交易。

var paymentMethodNonce = 'nonce_from_server';

client.verify3DS({
  amount: 500,
  creditCard: paymentMethodNonce
}, function (error, response) {
  if (!error) {
    // 3D Secure finished. 
    // Use nonce in response to create transaction. This should be different from the nonce created on your server.

    // console.log(response.nonce);
  } else {
    // Handle errors
  }
});

关于您关于责任转移的问题,3D 安全协议可以将欺诈责任从您作为商家转移到发卡机构 depending on which parties participate in 3D-Secure

回调中的响应对象包含有关责任是否转移或给定付款方式是否可能发生责任转移的详细信息。

client.verify3DS({
  amount: 500,
  creditCard: paymentMethodNonce
}, function (error, response) {
  if (!error) {
    // Response will also include liability shift details for you to use

    // console.log(response.verificationDetails);
  } else {
    // Handle errors
  }
});

我建议重新访问 what to do with the liability shift response values 上的文档。希望对您有所帮助!