#nikosalewski

1 messages · Page 1 of 1 (latest)

grand stagBOT
warm crest
crude mason
#

I somehow don't see the logs in the Stripe Dashboard.

warm crest
#

can you share the connected account id?

crude mason
#

Yes sure, it's acct_1NqkcIASIkZIXVax

warm crest
#

hmmm, are you able to share the Checkout Session id too?

crude mason
#

Where can I find it other than in the logs?

warm crest
#

sorry, lets take a couple of steps back - which line of code is this error coming from?

The specified Checkout Session could not be found. This error is usually caused by using the wrong API key or visiting an expired Checkout Session. Please make sure the Session is not expired and that the API keys used to initialize Stripe.js and create the Checkout Session are test mode keys from the same account.```

Since it's stating that `The specified Checkout Session could not be found` this means somewhere in your code is trying to access a specific Checkout Session id
crude mason
#

Created session with ID: cs_test_a1XROAivfXG9EO54jrfTDBWZLs75IozEZvNjOAHut36fCDnfcfRMXB58F2

warm crest
#

were you able to identify which line of code that error is coming from?

crude mason
#

Not yet..

warm crest
#

then you'll want to start with that first

crude mason
#

Every step seems to work, I get the correct priceId, the data is correct and the checkout session gets created. There are no errors shown in my Firebase log. I don't get Stripe logs. In the console I have this:

[Info] Successfully preconnected to https://api.stripe.com/

[Error] Failed to load resource: the server responded with a status of 404 () (init, line 0)

[Info] Successfully preconnected to https://r.stripe.com/

warm crest
#

I'm not familiar with Firebase so I'm not going to be of much help here. Since it says failed to load resource - what resource is it trying to load?

crude mason
warm crest
#

hmmmm, that's interesting, how are you redirecting the customer to the Checkout url? can you share the code snippet for that?

#

are you using stripe.redirectToCheckout?

crude mason
#

const handleClick = async (event) => {
// ...

const stripe = await stripePromise;
// ...

const session = await response.json();

const result = await stripe.redirectToCheckout({
  sessionId: session.id,
});

if (result.error) {
  console.error(result.error.message);
}

};

Yes

warm crest
#

aaah, i know why now

#

so you're using the StripeAccount header to create the Checkout Session - what this means is that the Checkout Session is created on your connected account.

However, you're probably only using your publishable key to initialize stripe on your frontend. The request to redirect, attempts to find the Checkout Session on your platform account (however, it exists on the connected account), that's why you receive a resource not found error

#

i don't recommend using stripe.redirectToCheckout. You would want to return the Checkout Session url to your frontend, and redirect client-side, probably using window.location.href

crude mason
#

Ahaaa! I'll adjust it and try the redirect using window.location.href. Thanks a lot, Alex

warm crest
crude mason
#

Oh yes, it worked. Thank you!!