#nikosalewski
1 messages · Page 1 of 1 (latest)
hi there, can you share the request id [0]? it'd look like req_xxx
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I somehow don't see the logs in the Stripe Dashboard.
can you share the connected account id?
Yes sure, it's acct_1NqkcIASIkZIXVax
hmmm, are you able to share the Checkout Session id too?
Where can I find it other than in the logs?
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
Created session with ID: cs_test_a1XROAivfXG9EO54jrfTDBWZLs75IozEZvNjOAHut36fCDnfcfRMXB58F2
were you able to identify which line of code that error is coming from?
Not yet..
then you'll want to start with that first
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/
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?
I found the error message with the missing resource:
{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such payment_page: 'cs_test_a1L97IRfc62O7s563iJkKzQuV2dP6c20Nv4MnNour8kWaFsqhNf1cJOP9p'",
"param": "payment_page",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_lANKdhc8cL9oyK?t=1695177181",
"type": "invalid_request_error"
}
}
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?
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
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
Ahaaa! I'll adjust it and try the redirect using window.location.href. Thanks a lot, Alex
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-url - this is the url you'll want to return to your frontend
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Oh yes, it worked. Thank you!!