#faultexception
1 messages · Page 1 of 1 (latest)
Why are you calling stripe API from client? Stripe API are supposed to be called from backend
I'm trying to call it from my client because that's where I'm integrating payments.
I'm using the stripe/stripe-js package and my understanding was that library was supposed to be called from your front end.
I followed the examples from this resource:
That's frontend and not suppose to call Stripe API
I would suggest following the complete Doc in https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements&client=react
Well, I suppose I'm not calling the Stripe API then, but when I make this call stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY); it fails
Um have you logged process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY and sure it has value?
And what error message do you have on that line?
Yes, I have a value.
It just says "Stripe failed to load' but I'm getting a 200 response, the only issue is that the server isn't setting a cross origin header
This is the error I'm getting when the GET posts:
GET https://js.stripe.com/v3 net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep 200
Weird. Do you have a public accessible URL?
I'm just doing everything on localhost for now
Just a quick POC so I can start framing out my elements before I try to go to a test environment.
And this is the header it's saying is not set:
Are you following exactly this guide? https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements&client=react
I'm on step 3
Can you clone this example: https://github.com/stripe-samples/accept-a-payment/tree/main/payment-element
Then follow the README instructions on https://github.com/stripe-samples/accept-a-payment/tree/main/payment-element
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Okay, I followed that guide and I can see the html, but I need to see the create-react-app version of this
How do I get it to run that front end?
please take a look at this security guide
https://stripe.com/docs/security/guide#content-security-policy
Okay, but that doesn't seem to be necesasry based on the same the last person sent.
When I try to run the create-react-app version of that sample, it says I have to enable javascript to run it
you're using nextjs?
you can download a full functioning app here https://stripe.com/docs/payments/quickstart?client=next
I'm using express
process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY this suggest you're using NEXT but in all cases you can choose whatever language you prefer in the page I sent you and will be able to download a fully functional app