Turn on Braintree, turn off the submit button during processing

I am trying to do something that seems easy, but I cannot get it to work. I am using the Brainree dropin UI and I have a submit button. I need to disable the button during processing, and I cannot find a good event to join.

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>
Run codeHide result

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

Any ideas? Thanks

+4
source share
3 answers

Braintree. , , , , , (, , ). , , , .

(, ), .

Mat, support@getbraintree.com, !

+2

Braintree . github: https://github.com/braintree/braintree-web/issues/38

- :

braintree.setup(TOKEN, 'dropin', {
    container: 'my-container',
    onError: function (payload) {
        if (payload.type === 'validation:failed') {
            // re-enable button
        }
    }
});
+2

I made a working example of how to use Braintree with WebForms.

https://github.com/StavrosD/BrainTree-PayPal-DotNet

I am describing a workflow on README.md.

0
source

All Articles