I am trying to create some kind of payment modal, where the user clicks on the payment method, in this case Stripe and, in a new tab, it opens the checkout page of stripe.
The problem is that apparently I can't generate the stripe checkout url from server-side, I've to use it in my own function:
stripe.redirectToCheckout({sessionId: data.id});
I wonder if there's a way in Jquery where I can store the url generated by that function and prevent the redirect, so I can use my own function?
Thank you in advance
There is not currently a way to generate the Checkout URL server side, or otherwise store it.
Just don't call that function until you're ready to actually redirect them.
my way
Use a button 'a link' target=_blank to the stripe button page
stripe button page Let it automatically jump to the stripe paypage
$( "#checkout-button" ).on( "click", function() {
fetch()
});
$( "#checkout-button" ).click();
$(function(){
fetch()
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.