Toggle stripe/checkout.js

Viewed 74

How can I toggle the stripe/checkout.js script after initializing it?

I have a form input field "coupon". If this has a value I would like to bypass the stripe popup/modal and submit right away.

So far I have not managed to unset the event that triggers the stripe functionality. This is the design I have attempted:

$('#coupon').bind('input', function(){
    if($('#coupon').val() != "") {
        switchToFreeSubmit()
        return;
    }

    switchToStripeSubmit()
});

How can I setup the toggle functions, or are there better ways?

0 Answers
Related