#Team Seeds
1 messages · Page 1 of 1 (latest)
Can you share the specific issue you're having here? You should be able to leverage stripe calls as you've written, in an effect or otherwise. What you do with that is more up to you, though.
it won't return the API call because async/await does not work in useEffect
are you familiar with react?
I am, and sure it does:
https://devtrium.com/posts/async-functions-useeffect#write-the-asynchronous-function-inside-the-useeffect
can you provide an example of how to make this work with the stripe API specifically?
I don't have any examples of that ready to go, no, but note that you should not be using the stripe package (stripe-node) client side like this with a secret key
This SDK is meant for secure server use only, you must not include your secret key in client code
yes, i understand. this is for a simple test app
Instead, you should run your own secure back end/api to accept these client request and return the stripe data necessary for the client
There should be no issue with the async calls in the effect
You should be able to replace the fetch call in the exmaple here with any async data retrieval:
https://devtrium.com/posts/async-functions-useeffect#note-on-fetching-data-inside-useeffect
ok, i'll check this out. thank you