#Arctic - next.js
1 messages ยท Page 1 of 1 (latest)
Hi ๐
This isn't documentation we maintain AFAIK so we cannot speak to whether it is up to date or not
okay
https://stripe.com/docs/checkout/quickstart but this one is up to date, the next.js version?
Yes that should be
i remember i had a problem with it at work today, but i will try again tomorrow then
thank you ๐
I hope it works out for you. If you have any questions while working through it we will be here
thanks so much:)
i just set up the guide again and getting some 401 responses from stripe api with
{
"error": {
"message": "Invalid API Key provided: undefined",
"type": "invalid_request_error"
}
}```
but i have the api key defined
Okay, how are you instantiating the Stripe client?
const stripePromise = loadStripe(
`${process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}`
)```
like this in my index file
and then passing it in elements as described in the guide
<Elements options={options} stripe={stripePromise}>
<CheckoutForm />
</Elements>
Okay so the error is stating the value passed in on loadStripe is undefined. Can you try first assigning that to a variable and logging the value?
okay
ohh, i have another stripe test project open in the same editor and was changing the .env file for the wrong project ๐
so sorry, my head is a little fried, now the api calls are going through:)
๐ Happy to hear it
Happy to help ๐
also, you might want to change this in the guide
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY);
to this
const stripePromise = loadStripe(
`${process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}`
)```
without the `` it was throwing an error for me that the value needs to be a string
Interesting. i thought the process.env did return a string
ive seen a few cases online where people had this error without the ``
Do you have examples of those issues online? I'm really curious under what circumstances process.env.SOME_KEY does not evaluate to a String
I cant recreate it right now
What is the value type without the ''? Like, what does process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY evaluate to if not a string?
it returns a string normally
thats why its confusing xD
ill look up the stackoverflow thread tomorrow at work pc and send it in here, maybe theres something helpfull
That's super confusing. Yeah, feel free to let us know. I'm also curious what the actual error is.
have that on the work pc aswell