stripe-samples / firebase-subscription-payments

Example web client for the `firestore-stripe-subscriptions` Firebase Extension using Stripe Checkout and the Stripe Customer Portal.
https://stripe-subs-ext.web.app/
MIT License
289 stars 78 forks source link

STRIPE CORS Error - "Response to preflight request doesn't pass access control check" #46

Open killiangemoets opened 2 years ago

killiangemoets commented 2 years ago

Hi there,

I'm working with ReactJS for the frontend and ExpressJS for the backend. I've a problem with the fetch on the overviewPage.js component. I do a post request to my backend to do a redirection to Stripe but this redirection doesn't work since I've a CORS error. I already to solve this error by using to cors module in my backend but it didn't solve anything.

Does anyone is able to help me please ??

Thank you!

Killian

https://github.com/killiangemoets/TieBreak

Screenshots from app.js and index.js (backend), and overviewPage.js (frontend)

Capture2 Capture3 Capture1
labnol commented 1 year ago

Related PR

bensontrent commented 1 year ago

You can fix this issue by changing line 215 in app.js from

.httpsCallable('ext-firestore-stripe-subscriptions-createPortalLink');

to

.httpsCallable('ext-firestore-stripe-payments-createPortalLink');

See https://github.com/stripe-samples/firebase-subscription-payments/pull/47#issuecomment-1312672555