stripe-archive / react-stripe-elements

Moved to stripe/react-stripe-js.
https://github.com/stripe/react-stripe-js
MIT License
3.03k stars 319 forks source link

injectStripe is not a function error #523

Closed patientplatypus6 closed 4 years ago

patientplatypus6 commented 4 years ago

Summary

I am using injectStripe as mentioned here (https://stripe.dev/react-stripe-elements/#card) and const CardForm = injectStripe(_CardForm); is returning the error TypeError: Object(...) is not a function. I'm not certain what is causing this.

Other information

Screen Shot 2020-05-28 at 3 50 45 PM

This is the example gist I'm working off of.

https://gist.github.com/patientplatypus6/f21ee944c903ea0938a3c88303b6abd5

cwimberger commented 4 years ago

Seems like I've run into the same issue while updating react and its dependencies. Any hint on how we can work around this issue?

asolove-stripe commented 4 years ago

Hi all! I think there's just some confusion here. The stripe.dev link you mentioned above is for this package, react-stripe-elements (which is being deprecated). But the code gist you link to is trying to import it from the new package, react-stripe-js, which has a different API. You are free to keep using this package if you like and follow those docs. But if you are going to use react-stripe-js, then please follow the code snippets there.