fix(checkout): redirect to Stripe instead of skipping to /success#397
Merged
Aamod-Dev merged 1 commit intoJun 21, 2026
Merged
Conversation
…loses niharika-mente#321) handleCheckout() was calling navigate('/success') immediately after the backend returned a session URL, bypassing Stripe entirely. No payment was taken, the webhook never fired, stock was never deducted, and no order record was created. Replace emptyCart() + navigate('/success') with window.location.href = data.url so the user is sent to the Stripe-hosted checkout page. Stripe then redirects to /success?session_id=... on completion, which triggers the webhook for fulfillment. SuccessPage already calls emptyCart() on mount via its own useEffect, so moving it there is correct.
|
@swetalin-10 is attempting to deploy a commit to the niharika-mente's projects Team on Vercel. A member of the Team first needs to authorize it. |
Aamod-Dev
approved these changes
Jun 21, 2026
Aamod-Dev
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, approved!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #321
Root cause
handleCheckout()inNavbar.jsxreceiveddata.url(the Stripe-hosted checkout URL) from the backend but never used it. Instead it callednavigate('/success')directly, so:checkout.session.completedwebhook never fired → no stock deduction, no order recordFix
FRONTEND/src/components/ui/Navbar.jsx— 2-line change:window.location.hrefperforms a full navigation to the Stripe-hosted checkout page. After the customer pays, Stripe redirects them to/success?session_id=..., which fires the webhook for fulfillment.emptyCart()is removed from the checkout handler becauseSuccessPagealready calls it on mount via its ownuseEffect— clearing the cart before payment was confirmed was also incorrect behaviour.Flow after this fix