#Ivan-Checkout

1 messages · Page 1 of 1 (latest)

tawdry mural
#

Hi Ivan, when you move the live mode, did you also update the publishable key in your frontend app?

noble nimbus
#

Yes, both keys, public in frontend and secret in backend.
Thanks for your response.

tawdry mural
#

OK, can you create a new checkout session in live mode and pass me the checkout session ID?

noble nimbus
#

ok course, in 5 sec

#

Here you are
evt_3Kd9CjGWrbXXekfw2qHBFYCk

#

Thanks Jack

tawdry mural
#

OK, I can see this checkout session is created successfully.

#

You can simply use the checkout session's url property to open the checkout page/

#

You can also use stripe.redirectCheckout to open the checkout page, but you need to make sure that that publishable key is correct

noble nimbus
#

The line stripe. redirecttocheckout is never reached with live keys

tawdry mural
#

I've deleted the message because there's live key in it

#

please avoid posting your live key in Discord

noble nimbus
#

Sorry, it was the public key.
If i don´t make you wrong, you suggest me to redirect from server side right?
I´m gonna try to do it.
But, how could I know why is this happenning?
Would you try to revoke the public key?

#

and create it again

tawdry mural
#

can you post the code again without your secret key?

noble nimbus
#

var stripe = Stripe('XXXXXXXXXXXXXX');
var form = document.getElementById("form1");
form.addEventListener('submit', function (e) {
e.preventDefault();
stripe.redirectToCheckout({
sessionId: "<%= stripeSessionId %>"
})
})

tawdry mural
#

OK, your code looks good to me, can you double check if the XXXXXXXXX is the correct publishable key?

noble nimbus
#

100% sure.
Double checked now, but i´ve been with this the whole weekend.

tawdry mural
#

OK, can you check the promise returned from stripe.redirectToCheckot and see if there's any error?

noble nimbus
#

This line is never reached in live mode.
This is the problem

tawdry mural
#

Do you have a public webpage where I can reproduce the problem?

noble nimbus
#

yes

tawdry mural
#

OK, I know the problem

#

You need to use HTTPS for Stripe.js live integration, this page is server over HTTP, not HTTPS

#

this link should work now

noble nimbus
#

no way.
I didn´t know this.
Thanks so mutch.
I´m gonna try right now

#

uoooooo.
it works.
Thanks.
you´re a master

tawdry mural
#

Welcome 🙂