简体   繁体   中英

Stripe RedirectToCheckout

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

  1. Use a button 'a link' target=_blank to the stripe button page

  2. stripe button page Let it automatically jump to the stripe paypage

    $( "#checkout-button" ).on( "click", function() {
       fetch()
    });
    $( "#checkout-button" ).click();
  1. Or just do it like this
    $(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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM