#Laxislad-checkout-react
1 messages · Page 1 of 1 (latest)
Hi, what are you trying to do in react exactly?
The youtube video is about checkout sessions (created on the backend)
yeah I wanna add card for future payment
I'm using react and node
https://stripe.com/docs/payments/save-and-reuse?html-or-react=react I followed this doc and I'm stuck
I was going to redirect you to that link
what part are you stuck in this way I could help you out better
ok
https://stripe.com/docs/payments/save-and-reuse?html-or-react=react#web-submit-payment-details I'm stuck in here
what part of the code are you having trouble implementing?
I created the submiting card details part
I don't understand how to go forward after this
after confirmSetup you mean?
ok so the idea is that when you submit the handleSubmit will try to confirm the SetupIntent you created
if you follow the code that would do for you
the only thing that you need to change is the return_url
I did
which should get you to another component (if you're using React Router another path)
oh...
your payementstatus component should be also wrapped by the <Elements stripe={stripePromise} options={options}>
oh thaths why
what are the options should I pass?
router?
BrowserRouter
could you share a bit more code please?
for navigation react-router-dom
how are you transforming this js array of Objects to links
and routes
usually in React Router we use <Switch> <Route exact path="/"> <Home /> </Route> <Route path="/about"> <About /> </Route> <Route path="/dashboard"> <Dashboard /> </Route> </Switch>
I use this
{routes.map(({ element, path, name }) => (
<Route
key={name}
path={path}
element={<ProtectedRoute element={element} />}
/>
))}
ok
In that case it's better to use nested routes for your use case
where instead of having the <Elements ... be on the App level you could probably put it on a route that has nested routing and you put another <Switch> component inside the <Elements> tag
this way you'd have both the setup and the paymentstatus wrapped with the <Elements> tag and you would be able to continue following the tutorial in our docs
ah thanks
so I have to consider PaymentSuccess as a differet page and also
Hey, taking over from my colleague here. Let me know if you have a specific issue/question!