角控制器无法检测布伦特里支付现时动态inputed场 [英] Angular controller can't detect Braintree payment nonce dynamically inputed field

查看:186
本文介绍了角控制器无法检测布伦特里支付现时动态inputed场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

布伦特里的客户创造SDK系统一旦生成的形式随机数输入字段你打提交。

Braintree's customer creation SDK system generates a nonce input field in the form as soon as you hit submit.

<input name="payment_method_nonce" type="hidden" value="nonce-here">

然而,随着角度的NG-模型输入识别系统,我无法检测到在我的控制器动态生成的输入。我在我的控制器,只要提交表单执行的功能。

However, with Angular's ng-model input identification system I can't detect the dynamically generated input in my controller. I'm executing a function in my controller as soon as the form is submitted.

<form id="checkout" id="checkout" ng-submit="processForm(formData)">


  
 
  

正如你所看到的,有没有办法来收集随机数的值,并将其提交给大脑树API命令如创建一个新用户的付款方式。

As you can see, there's no way to collect the value of the nonce and submit it to a brain tree API command such as creating a new user's payment method.

从控制器的数据将低于使用$ HTTP提交布伦特里API命令。

From the controller the data would be submitted to the braintree api command below using $http.

gateway.customer.create({
creditCard: {
token: "creditCard123",
},
paymentMethodNonce: "nonce-from-the-client"
}, function (err, result) {
});

我要对这个错误的方式?我应该只是杰里 - 钻机使用,即使该应用程序是在角/ EX preSS纯节点的解决方案?或者我应该使用jQuery /角在上述输入字段植入一个NG-模式?

Am I going about this the wrong way? Should I just jerry-rig a solution using pure node even though this application is in Angular/express? Or should I use jquery/angular to implant a ng-model in the said input field?

推荐答案

我在布伦特里工作的SDK团队。

I work at Braintree on the SDK team.

您可以使用一个回调来监听随机数而不是它会自动写入到DOM的。

You can use a callback to listen for the nonce instead of having it automatically written to the DOM.

braintree.setup('CLIENT_TOKEN', 'dropin', {
    container: 'container',
    paymentMethodNonceReceived: function (event, nonce) {
      // Do something with the nonce here
    }
});

这也将prevent从您的名义被自动提交表单。你可以在这里阅读一些进一步的文档。如果您继续遇到问题,可随时接触到support@getbraintree.com。

This will also prevent the form from being automatically submitted on your behalf. You can read some further documentation here. If you continue to encounter issues, feel free to reach out to support@getbraintree.com.

这篇关于角控制器无法检测布伦特里支付现时动态inputed场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆