Skip to content

beretests/stripe-checkout-tutorial-fe

Repository files navigation

Stripe Checkout Example with Material UI, Vite, and Tailwind CSS

Overview

This project demonstrates a complete e-commerce checkout flow using Material UI, Vite, Tailwind CSS, and Stripe.
It features a multi-step checkout process, payment integration, and modern UI/UX best practices.


Features

  • Multi-step checkout: Customer Info → Payment Details → Order Complete
  • Stripe Checkout integration (client and server)
  • Email and order state managed via React Context
  • Responsive design with Material UI and Tailwind CSS
  • Snackbar notifications for user feedback
  • Clean, modular component structure

How the App Works

  1. Customer Info Step

    • User enters their email and address.
    • Email is managed globally using React Context for access across all steps.
  2. Payment Details Step

    • User enters payment information.
    • Stripe Elements are used for secure card entry.
    • On submission, the app creates a Stripe Checkout session via the backend.
  3. Order Complete Step

    • After successful payment, the user is redirected to the Complete page.
    • The app fetches the session status from the backend and displays order/payment details.
    • User can view payment details on Stripe or start a new order.
  4. Notifications

    • Snackbar notifications are shown for success, errors, and important actions throughout the flow.

Main Components

  • App.tsx
    Sets up routing and global providers (Email, Snackbar).

  • contexts/EmailContext.tsx
    Provides global email state across the checkout flow.

  • contexts/SnackbarContext.tsx
    Provides global snackbar notification functionality.

  • components/CheckoutWrapper.tsx
    Handles Stripe Elements setup and wraps the main checkout steps.

  • components/Checkout.tsx
    Implements the multi-step checkout UI and logic.

  • components/Complete.tsx
    Displays the order summary and payment status after checkout.

  • components/Info.tsx
    Shows a summary of the user's order and email.


Technologies Used


Getting Started

Download the example or clone the repo:

curl https://codeload.github.com/mui/material-ui/tar.gz/master | tar -xz --strip=2 material-ui-master/examples/material-ui-vite-tailwind-ts
cd material-ui-vite-tailwind-ts

Install dependencies and run the app:

npm install
npm run dev

Customization

  • Update products in src/data/products.ts.
  • Configure Stripe keys in your .env file.
  • Adjust styling using Material UI theme or Tailwind classes.

Learn More


You now have a working example project.
Continue by browsing the Material UI templates or customizing this checkout flow for your needs.

Attribution

This project uses code and patterns from Material UI examples, which are licensed under the MIT License.
See the following sources for original code and inspiration:

Material UI is licensed under the MIT License.
A copy of the MIT License is included below:


MIT License

Copyright (c) 2014-present Material UI contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages