简体   繁体   English

有什么方法可以检测到braintree.js表单的提交点击?

[英]Is there any way to detect a drop-in braintree.js form's submit click?

I'm using a braintree.js drop in form. 我正在使用braintree.js表单。 I'm submitting it with ajax, by registering for the onPaymentMethodReceived callback. 我通过注册onPaymentMethodReceived回调与Ajax一起提交。 So far so good, it works fine. 到目前为止,一切正常。

However, after submitting the form, there's a two step process: first the payment details are submitted to braintree and verified (while a spinner shows over the form), then the details on the page are anonymised, and the onPaymentMethodReceived callback fires with a nonce I can use to send to my server. 但是,提交表单后,需要执行两个步骤:首先将付款详细信息提交给braintree并进行验证(同时微调框显示在表单上),然后将页面上的详细信息匿名化,并且onPaymentMethodReceived回调会以随机数触发我可以用来发送到我的服务器。

The problem is I'd like to disable the form submission button when it's clicked, but registering an onClick handler on it causes braintree to ignore the click. 问题是我想在单击表单提交按钮时禁用它,但是在其上注册onClick处理程序会导致Braintree忽略该单击。

I understand that the customer's card details are visible on the page at this point, but I can't grab them anyway due to the iframe being from a different domain, and any potential method I could use at this point to grab the details I could do with setInterval() anyway, so I don't really see a security case for this. 我了解到客户卡的详细信息此时已显示在页面上,但是由于iframe来自其他域,我还是无法抓取它们,此时我可以使用任何可能的方法来抓取我的详细信息无论如何setInterval()使用setInterval() ,所以我真的没有看到安全案例。

Is there any way to detect the click here? 有什么方法可以检测点击吗?

Full disclosure: I work at Braintree. 全面披露:我在Braintree工作。 If you have any further questions, feel free to contact support . 如果您还有其他疑问,请随时与支持小组联系。

To my knowledge you can't jump in the middle of the tokenization process with the Drop-In. 据我所知,使用Drop-In无法进入标记化过程的中间。 It sounds like you are looking to create a custom experience for your users that steps beyond the Drop-In use case . 听起来您正在寻求为用户创建自定义体验,这超出了Drop-In用例的范围

Enabling a form submit button after the onPaymentMethodReceived callback is the common Drop-In use flow, but by creating a custom integration you can directly handle the client-side tokenization process and wrap it with whatever functionality you need: 常见的Drop-In使用流程是在onPaymentMethodReceived回调之后启用表单提交按钮,但是通过创建自定义集成,您可以直接处理客户端令牌化过程并将其包装为所需的任何功能:

var client = new braintree.api.Client({clientToken: "CLIENT-TOKEN-FROM-SERVER"});

client.tokenizeCard({
  number: "4111111111111111",
  expirationDate: "10/20"
}, function (err, nonce) {
  // Send nonce to your server
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM