I've integrated the Stripe checkout button with script tag inside a form, according to the standard example. It works if the content is output as a new HTML page, but if the content is introduced dynamically (via Ajax and innerHTML), the button isn't shown. How can I trigger it manually?
Two ways I can think of, the first, and I'd say the best way, is don't use the Standard Example, but instead use Stripe's Custom Example. Then you can just call handler.open({...})
.
Or, if you must use the inline script, I forced the button's click event using jQuery.
$(".stripe-button-el").click();
But I don't recommend this because not all browsers are going to support it for security reasons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With