Braintree插入,处理时禁用提交按钮(Braintree drop

编程入门 行业动态 更新时间:2024-10-18 22:26:48
Braintree插入,处理时禁用提交按钮(Braintree drop-in, disable submit button while processing)

我正在尝试做一些看似简单的事情,但我无法让它发挥作用。 我正在使用Braintree dropin UI,我有提交按钮。 我需要在处理时禁用该按钮,我找不到要附加的好事件。

var ct = 'tokenhere';
var bt = braintree.setup(ct, 'dropin', {
  container: 'braintreedropin',
}); 
  
<form id="PayByBrainTreeCheckout" method="post">
  <div id="braintreedropin"></div>       
  <input type="submit" value="Pay">                          
</form> 
  
 

我尝试了$('#PayByBrainTreeCheckout').submit(function(){/*disable button*/})但如果表单中存在验证错误,这也会禁用该按钮。

有任何想法吗? 谢谢

I'm trying to do something that seems easy but I cannot get it to work. I'm using Braintree dropin UI and I have submit button. I need to disable the button while processing and I cannot find a good event to attach to.

var ct = 'tokenhere';
var bt = braintree.setup(ct, 'dropin', {
  container: 'braintreedropin',
}); 
  
<form id="PayByBrainTreeCheckout" method="post">
  <div id="braintreedropin"></div>       
  <input type="submit" value="Pay">                          
</form> 
  
 

I tried $('#PayByBrainTreeCheckout').submit(function(){/*disable button*/}) but this is also disabling the button if there is a validation error in the form.

Any ideas? Thanks

最满意答案

我也在Braintree工作。 你是正确的,客户可以在提交交易时点击提交按钮两次,但你不必担心客户被收取两次费用,因为第二次交易将失败(信用卡产生的现金可以只能使用一次)。 此外,提交后表格上的直接视觉反馈旨在让客户知道他们正在处理按钮印刷。

如果您确实想要执行更复杂的操作(例如添加自定义回调以禁用提交按钮),我们的自定义集成是一个不错的选择。

正如Mat提到的,如果您需要进一步的集成帮助,请随时联系support@getbraintree.com!

I work at Braintree as well. You're correct that the customer can hit the submit button twice while the transaction is being submitted, but you don't have to worry about the customer being charged twice, as the second transaction will fail (the nonce generated by the credit card can only be used once). Furthermore, the immediate visual feedback on the form after submission is designed to let customers know their button press is being processed.

If you do want to do more complex things (such as adding a custom callback to disable the submit button), our custom integration is a good option.

As Mat mentioned, feel free to reach out to support@getbraintree.com if you need further assistance with your integration!

更多推荐

本文发布于:2023-08-07 11:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464518.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按钮   Braintree   drop

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!