A modern, full-stack payment management application built with React, Node.js, and Stripe. Features a beautiful UI for managing payment methods, processing payments, and viewing payment history with cross-device synchronization.
- Beautiful Design: Clean, modern interface with blue/white theme
- Responsive Layout: Works perfectly on desktop, tablet, and mobile
- Smooth Animations: Engaging hover effects and transitions
- Form Validation: Real-time validation with helpful error messages
- Save Payment Methods: Securely store customer cards using Stripe
- Quick Payments: One-click payments with preset amounts ($5, $10, $25, $50)
- Custom Amounts: Process payments for any amount
- Payment History: Comprehensive transaction history with filtering
- Local Storage: Automatic local data persistence
- Global Sync: Share data across multiple devices
- Device Tracking: See which device made each payment
- Manual Sync: Force synchronization when needed
- Stripe Integration: Industry-standard payment processing
- Data Encryption: All payment data is encrypted by Stripe
- Error Handling: Comprehensive error handling and user feedback
- Offline Support: Local storage backup for offline access
- Node.js 18+ installed
- Stripe account with API keys
- Git installed
git clone https://github.com/yourusername/paymenthub.git
cd paymenthub
# Install frontend dependencies
npm install
# Install backend dependencies
cd api
npm install
cd ..
Create a .env
file in the root directory:
# Stripe Keys (Get these from your Stripe Dashboard)
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key_here
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key_here
# Optional: API URL (defaults to /api in production)
VITE_API_URL=http://localhost:4000/api
# Optional: Default customer ID (for testing)
VITE_STRIPE_CUSTOMER_ID=cus_your_customer_id_here
- Go to Stripe Dashboard
- Navigate to Developers β API Keys
- Copy your Publishable key and Secret key
- Paste them into your
.env
file
# Start the backend server (Terminal 1)
cd api
npm start
# Start the frontend development server (Terminal 2)
npm run dev
The application will be available at:
- Frontend: http://localhost:5173
- Backend: http://localhost:4000
paymenthub/
βββ src/ # Frontend React application
β βββ components/ # React components
β β βββ AddCardForm.jsx # Card addition form
β β βββ QuickPay.jsx # Quick payment component
β β βββ SavedCardsDropdown.jsx # Card selection
β β βββ PaymentHistoryDashboard.jsx # History view
β βββ context/ # React Context
β β βββ PaymentContext.jsx # Global state management
β βββ App.jsx # Main application component
β βββ main.jsx # Application entry point
βββ api/ # Backend Node.js server
β βββ server.js # Express server with Stripe integration
β βββ package.json # Backend dependencies
βββ public/ # Static assets
βββ .env # Environment variables (create this)
βββ .gitignore # Git ignore rules
βββ README.md # This file
Variable | Description | Required |
---|---|---|
STRIPE_SECRET_KEY |
Your Stripe secret key | β Yes |
VITE_STRIPE_PUBLISHABLE_KEY |
Your Stripe publishable key | β Yes |
VITE_API_URL |
Backend API URL | β Optional |
VITE_STRIPE_CUSTOMER_ID |
Default customer ID | β Optional |
PORT |
Server port (default: 4000) | β Optional |
- Create a Stripe account
- Enable test mode for development
- Get your API keys from the dashboard
- For production, switch to live keys and disable test mode
- Navigate to the Make Payment tab
- Scroll to Add New Card section
- Fill in customer name and card details
- Click Save Card to store securely with Stripe
- Select a saved payment method
- Choose a quick amount or enter custom amount
- Click Pay Now to process the payment
- View confirmation and transaction details
- Click the Payment History tab
- View summary cards with key metrics
- Browse detailed transaction table
- See device information for each payment
- Use the sync button to refresh data
- Data automatically syncs across devices
- Each device gets a unique session ID
- Manual sync available via the sync button
- View which device made each payment
# Frontend development
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint
# Backend development
cd api
npm start # Start backend server
npm run dev # Start with nodemon (auto-restart)
- Frontend: React 18, Vite, Stripe.js
- Backend: Node.js, Express, Stripe SDK
- Styling: CSS3 with modern features
- Storage: LocalStorage + In-memory (production: use database)
- State Management: React Context API
- Build the project:
npm run build
- Deploy the
dist
folder - Set environment variables in your hosting platform
- Push the
api
folder to your hosting service - Set environment variables
- Ensure the start script runs
node server.js
The backend serves the frontend in production mode:
npm run build
cd api
NODE_ENV=production npm start
- β
Never commit
.env
files to Git - β Use test keys during development
- β Validate all inputs on both client and server
- β Use HTTPS in production
- β Regularly rotate API keys
- β Monitor Stripe dashboard for suspicious activity
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues:
- Review the Stripe documentation
- Ensure all environment variables are set correctly
- Check browser console for error messages
- Stripe for excellent payment processing
- React for the amazing framework
- Vite for lightning-fast development
Made with β€οΈ by ModupeD