Skip to content

chandm1213/Privatepay

Repository files navigation

PrivatePay - Privacy-First Payment Infrastructure

A modern, privacy-focused payment card issuance platform built on Solana blockchain. Issue instant virtual cards, receive SOL payments, and manage digital payments with complete privacy.

🎯 Project Overview

PrivatePay is a web application that allows users to:

  • Issue instant virtual cards in under 2 minutes
  • Make payments with Solana for card activation
  • Complete privacy - no KYC required
  • Global acceptance - cards work anywhere Visa/Mastercard accepted
  • Real-time QR code payments - pay via Solana wallet

Built for hackathons showcasing blockchain payment integration, privacy preservation, and modern fintech infrastructure.

✨ Key Features

  • Instant Card Issuance: Create virtual cards in seconds without paperwork
  • Solana Integration: Direct SOL payments with real-time exchange rates
  • Privacy First: No KYC verification required, non-custodial architecture
  • QR Code Payments: Scan and pay directly from Solana wallets
  • Responsive Design: Mobile-optimized UI with smooth animations
  • Real-time Status: Live order tracking and payment confirmation
  • Global Coverage: Support for 180+ countries

πŸ› οΈ Tech Stack

Frontend

  • Next.js 16 - React framework with App Router
  • React 19.2 - Latest React with concurrent features
  • TypeScript - Type-safe development
  • Tailwind CSS v4 - Utility-first CSS
  • Shadcn/ui - High-quality UI components
  • Recharts - Data visualization
  • Lucide React - Beautiful icons

Backend

  • Next.js API Routes - Serverless backend
  • Supabase - PostgreSQL database + Auth
  • Solana Web3.js - Blockchain interactions
  • Starpay API - Card issuance & payment processing

Infrastructure

  • Vercel - Deployment & hosting
  • Helius - Solana RPC provider

πŸ“‹ Prerequisites

Before running the project, you'll need:

  • Node.js 18+ and npm/yarn
  • Starpay API Key - Sign up at Starpay
  • Supabase Account - Create at Supabase
  • Helius API Key - Create at Helius
  • Solana Wallet - For master wallet setup (private key)

πŸš€ Getting Started

1. Clone the Repository

git clone <repository-url>
cd privatepay

2. Install Dependencies

npm install
# or
yarn install

3. Environment Setup

Create a .env.local file in the root directory:

# Supabase (Public - safe for client)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key

# Starpay API (Server-only)
STARPAY_API_KEY=your_starpay_api_key

# Master Wallet (Server-only - KEEP SECRET)
MASTER_WALLET_PRIVATE_KEY=your_base64_encoded_private_key
MASTER_WALLET_ADDRESS=your_master_wallet_address

# Helius RPC (Server-only)
HELIUS_API_KEY=your_helius_api_key

# Supabase (Server-only)
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

4. Run Development Server

npm run dev
# or
yarn dev

Open http://localhost:3000 in your browser.

5. Build for Production

npm run build
npm start
# or
yarn build
yarn start

πŸ“ Project Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/                          # API endpoints
β”‚   β”‚   β”œβ”€β”€ starpay/                 # Card & payment APIs
β”‚   β”‚   β”‚   β”œβ”€β”€ create-order/        # Create Starpay order
β”‚   β”‚   β”‚   β”œβ”€β”€ check-order-status/  # Check order status
β”‚   β”‚   β”‚   └── me/                  # Get account info
β”‚   β”‚   └── price/
β”‚   β”‚       └── sol/                 # Get SOL/USD price
β”‚   β”œβ”€β”€ components/                   # React components
β”‚   β”‚   └── card-purchase.tsx        # Card purchase flow
β”‚   β”œβ”€β”€ context/                      # React context
β”‚   β”œβ”€β”€ page.tsx                      # Main landing page
β”‚   β”œβ”€β”€ layout.tsx                    # Root layout
β”‚   └── globals.css                   # Global styles & theme
β”œβ”€β”€ lib/                              # Utilities & helpers
β”‚   β”œβ”€β”€ starpay-client.ts            # Starpay API client
β”‚   β”œβ”€β”€ solana-verify.ts             # Solana verification
β”‚   └── utils.ts                     # Helper functions
β”œβ”€β”€ scripts/                          # Database setup
β”œβ”€β”€ public/                           # Static assets
└── package.json                      # Dependencies

πŸ”Œ API Endpoints

Card Payment

  • POST /api/starpay/create-order - Create payment order
  • POST /api/starpay/check-order-status - Check order status
  • POST /api/starpay/me - Get account information

Pricing

  • GET /api/price/sol - Get current SOL/USD price

🎨 Design System

Colors

  • Primary: #7c3aed (Violet/Purple)
  • Secondary: #6366f1 (Indigo)
  • Accent: #fbbf24 (Amber)
  • Background: #0f0f0f (Near Black)
  • Surface: #1a1a1a (Dark Gray)

Typography

  • Font: Geist (primary), Geist Mono (code)
  • Headings: Bold, 24px-64px
  • Body: Regular, 14px-16px
  • Line Height: 1.5-1.6

πŸ” Security

  • Private Keys: Never exposed to client, server-only
  • API Keys: Environment variables, not in code
  • HTTPS Only: Enforced in production
  • Input Validation: Zod schema validation
  • SQL Injection Prevention: Parameterized queries via Supabase
  • CORS: Configured for allowed origins

🌐 Deployment

Deploy to Vercel

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

Set environment variables in Vercel dashboard:

  • Go to Settings β†’ Environment Variables
  • Add all variables from .env.local

πŸ“± Mobile Support

The application is fully responsive and works on:

  • Desktop browsers (Chrome, Firefox, Safari, Edge)
  • Tablets (iPad, Android tablets)
  • Mobile devices (iOS Safari, Chrome Mobile)

πŸ’³ Card Features

  • Valid Range: $5 - $10,000
  • Issuance Speed: < 2 minutes
  • Currency: USD
  • Network: Visa & Mastercard
  • Regions: 180+ countries
  • Fee: 2.5% (Starpay markup)

🎯 User Flow

  1. User selects card amount ($5-$10,000)
  2. System creates Starpay order
  3. User receives QR code with SOL address
  4. User scans with Solana wallet and sends payment
  5. System confirms payment via Starpay
  6. Card details displayed to user
  7. Card ready for use within 2 minutes

πŸ› Debugging

Check browser console for debug logs:

[v0] Order status poll result: {...}
[v0] Expected SOL: 0.021333
[v0] Payment received: pending

πŸ“Š Performance

  • Lighthouse Score: 90+
  • Core Web Vitals: All green
  • Build time: < 30s
  • API response: < 200ms

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“ License

MIT License - feel free to use this for your hackathon!

πŸ†˜ Support

For issues or questions:

  • Check the documentation
  • Review API error messages in console
  • Verify environment variables are set correctly
  • Check Starpay & Supabase dashboard for API limits

πŸš€ Future Enhancements

  • Multiple card designs
  • Card spending limits
  • Transaction history
  • Wallet connectivity improvements
  • Mobile app (Flutter)
  • Admin dashboard
  • Analytics & reporting

πŸ“š Resources


Built with ❀️ for hackathons.

About

The all-in-one privacy layer for Solana, enabling anonymous global spending and encrypted payment links without KYC.The all-in-one privacy layer for Solana, enabling anonymous global spending and encrypted payment links without KYC.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors