#bal-react-usestripe
1 messages · Page 1 of 1 (latest)
@empty rapids this is a React requirement, you need to make sure that useStripe() wraps your whole application
would I place that in like an App.js?
And do we need to have client secret in the app at all times or can it just be generated when we want to handle a payment?
I recommend going through the steps at https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements&client=react
for your second question it depends how you integrate. There are many different ways to build a Stripe integration and you have to pick one. If you want to only load the "client secret" on demand you likely want to follow https://stripe.com/docs/payments/accept-a-payment-deferred instead
bal-react-usestripe
now im getting this
that error seems pretty descriptive to me.
you are trying to initialize Stripe, it takes an API key, you didn't pass an API key
const stripe = useStripe();
so useStripe needs it?
The docs I linked you to have step by step instructions on how to use Stripe.js in React. They show you how to call loadStripe() for example with an API key.
Lol, sorry I am an idiot its because I placed the API key in process env and I didnt have it in my directory lol
Ah, so it's working now?