【问题标题】:Braintree client-token validation errorBraintree 客户端令牌验证错误
【发布时间】:2016-07-18 13:06:02
【问题描述】:

我正在使用 braintree Drop-in UI 与 angularjs(frontend) 和 rails(Backend)。我正在创建一个 clientToken 并将其发送到 Braintree 设置。

客户端令牌方法,

@client_token = Braintree::ClientToken.generate(customer_id: current_user.braintree_customer_id,options: {
            verify_card: true,
            fail_on_duplicate_payment_method: true
            })

如您所见,我选择了“fail_on_duplicate_payment_method”选项。并尝试再次添加相同的付款方式。

然后,通过该验证,我在 dropin 上收到错误消息 “处理您的请求时出错”,但它不会出现在错误回调中。

这是设置,很好,

 braintree.setup(vm.clientToken, 'dropin', {
    container: 'dropin-container',
    onPaymentMethodReceived: function(data) 
    { 
      alert('came recieved')
      // console.log($scope.paymentForm)
      vm.submit($scope.paymentForm, data.nonce)
    },
    onReady: function ()  {
        vm.disablePay = false;
    },
    onError: function(type, message)  {
        alert('came error')
        vm.serverError = message;
    }
});

这是错误的图像,

网络中的错误是,

callback_jsona7f3c885267b4f49aa13fbf01cecdb60({"error":{"message":"Credit card is invalid"},<br>"fieldErrors":[{"field":"creditCard","fieldErrors":[{"field":"number","code":"81724","message":"Duplicate card exists in the vault"}]}],"status":422})

我想将此错误提取到我的视图中。我搜索了很多链接,但没有得到我需要的答案。任何帮助都是可观的。
提前谢谢你。

【问题讨论】:

    标签: ruby-on-rails braintree


    【解决方案1】:

    完全披露:我是 Braintree 的开发人员

    onError 回调仅由客户端错误触发,这实际上是服务器端错误;但是,该团队意识到了这一需求,并正在研究一种将在未来版本中提供的解决方案。

    【讨论】:

      猜你喜欢
      • 2019-05-28
      • 1970-01-01
      • 2016-06-11
      • 2018-04-20
      • 2018-04-27
      • 1970-01-01
      • 2019-01-31
      • 1970-01-01
      • 2020-08-12
      相关资源
      最近更新 更多