Stripe-style stablecoin payments, built natively on ARC
β οΈ This is the PUBLIC repository (arc-pay-public). This repository contains:
- β Smart contracts (audit-ready)
- β Public backend core (demo/audit mode only)
- β Frontend integration
β NOT included: Real settlement logic, CCTP bridging, payout processing, production secrets
See ARCHITECTURE.md and SECURITY.md for details.
A production-grade payment gateway platform similar to Stripe or Circle Payments, built natively on the ARC blockchain. The application provides enterprise-quality payment processing with features including payment creation, invoicing, webhook management, refunds, and treasury operations.
This public repository runs in demo mode only. Set ARCPAY_PUBLIC_DEMO_MODE=true to run.
- β Full Payment Lifecycle - Created β Pending β Confirmed/Failed/Expired
- β ARC Testnet Integration - Native support for ARC blockchain transactions
- β Transaction Verification - On-chain transaction verification via RPC
- β Non-Custodial Architecture - Gateway never holds funds
- β Wallet Integration - WalletConnect support for seamless payments
- β Demo Mode - Test the platform without real transactions
- β Merchant Dashboard - Comprehensive dashboard for managing payments
- β API Key Management - Secure API key generation and management
- β Payment Links - Generate shareable payment links
- β QR Code Payments - Generate QR codes for easy payments
- β CSV Export - Export payment data for accounting
- β Treasury Management - Track and manage treasury balances
- β Webhook System - HMAC-signed webhooks with retry logic
- β Refund Management - Non-custodial refund processing
- β On-Chain Proof Layer - Smart contracts for payment receipts
- β Merchant Badge SBT - Non-transferable badges for verified merchants
- β Rate Limiting - API rate limiting for security
- β Admin Portal - Administrative interface for platform management
- React 18 with TypeScript
- Vite - Build tool and dev server
- Wouter - Lightweight routing
- TanStack React Query - Server state management
- shadcn/ui - UI component library
- TailwindCSS - Styling
- Framer Motion - Animations
- React Hook Form + Zod - Form handling and validation
- RainbowKit + Wagmi - Wallet connection
- Node.js with Express
- TypeScript - Type safety throughout
- Drizzle ORM - Database ORM
- PostgreSQL - Database (Neon for serverless)
- Express Sessions - Session management
- Passport - Authentication
- ARC Testnet - Chain ID: 5042002
- Foundry - Smart contract development
- OpenZeppelin Contracts - Secure contract libraries
- viem - Ethereum library for TypeScript
- MerchantBadge.sol - Non-transferable SBT for verified merchants
- InvoicePaymentProof.sol - On-chain payment receipt records
- Node.js 18+ and npm
- PostgreSQL database (or Neon account)
- WalletConnect Project ID (Get one here)
- Wallet with ARC Testnet USDC for gas fees
-
Clone the repository
git clone https://github.com/yourusername/arc-payment-gateway.git cd arc-payment-gateway -
Install dependencies
npm install
β οΈ Important: If you encounter SES-related errors or wallet connection issues after updating dependencies, perform a clean install:Windows (PowerShell):
Remove-Item -Recurse -Force node_modules, package-lock.json -ErrorAction SilentlyContinue npm install npm run build
macOS/Linux:
rm -rf node_modules package-lock.json npm install npm run build
The dependency overrides in
package.jsonensure compatible wallet SDK versions that don't inject SES. -
Set up environment variables
Create
.envin the project root:DATABASE_URL=postgresql://user:password@host/dbname PORT=3000 SESSION_SECRET=your-session-secret-here ARC_CHAIN_ID=5042002 ARC_RPC_URL=https://rpc.testnet.arc.network ARC_EXPLORER_URL=https://testnet.arcscan.app/tx DEMO_MODE=true MERCHANT_BADGE_ADDRESS=0x... INVOICE_PAYMENT_PROOF_ADDRESS=0x...
Create
client/.env:VITE_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_id VITE_API_URL=http://localhost:3000 VITE_ARC_CHAIN_ID=5042002 VITE_ARC_RPC_URL=https://rpc.testnet.arc.network VITE_ARC_EXPLORER_URL=https://testnet.arcscan.app/tx VITE_MERCHANT_BADGE_ADDRESS=0x... VITE_INVOICE_PAYMENT_PROOF_ADDRESS=0x...
-
Set up database
npm run db:push
-
Run the application
Public Repository (Demo Mode):
# Set demo mode (required) export ARCPAY_PUBLIC_DEMO_MODE=true # Linux/macOS # or set ARCPAY_PUBLIC_DEMO_MODE=true # Windows CMD # or $env:ARCPAY_PUBLIC_DEMO_MODE="true" # Windows PowerShell # Optional: Set API base URL for frontend export VITE_API_BASE_URL=http://localhost:3001 # Run frontend npm run dev # Run demo server (in separate terminal) npm run server
The app will be available at
http://localhost:5000(or PORT from .env)Note:
- The public repository requires
ARCPAY_PUBLIC_DEMO_MODE=true. The server will refuse to start without it. - Database (
DATABASE_URL) is optional in demo mode - public routes use in-memory storage - Only
/api/public/*endpoints work without a database
- The public repository requires
- QUICK_START.md - Quick setup guide
- SETUP.md - Detailed setup instructions
- IMPLEMENTATION_SUMMARY.md - Complete feature list
- CONTRACT_DEPLOYMENT.md - Smart contract deployment guide
- ON_CHAIN_PROOF_LAYER_IMPLEMENTATION.md - On-chain features documentation
- ADMIN_PORTAL_SETUP.md - Admin portal setup
- ENV_SETUP_GUIDE.md - Environment variables guide
- ENV_TEMPLATES.md - Environment variable templates
POST /api/payments/create- Create a new paymentGET /api/payments/:id- Get payment detailsPOST /api/payments/confirm- Confirm payment with transaction hashPOST /api/payments/fail- Mark payment as failedPOST /api/payments/expire- Expire a payment
POST /api/payments/:id/refund- Create refund intentPOST /api/refunds/:id/complete- Complete refund with transaction hashGET /api/refunds/:id- Get refund detailsGET /api/payments/:id/refunds- Get all refunds for a payment
POST /api/webhooks/subscriptions- Create webhook subscriptionGET /api/webhooks/subscriptions- List webhook subscriptionsPUT /api/webhooks/subscriptions/:id- Update webhook subscriptionDELETE /api/webhooks/subscriptions/:id- Delete webhook subscriptionGET /api/webhooks/events- Get webhook event logs
GET /api/badges/status- Get merchant badge statusGET /api/badges/eligibility- Check badge eligibilityPOST /api/badges/record-mint- Record badge mint transaction
GET /api/payments/:id/proof- Get payment proof statusPOST /api/payments/:id/generate-invoice-hash- Generate invoice hashPOST /api/payments/:id/record-proof- Record payment proof on-chain
The API uses API key authentication. Include your API key in requests:
# Using Authorization header
Authorization: Bearer your_api_key_here
# Or using x-api-key header
x-api-key: your_api_key_here
# Or as query parameter
?apiKey=your_api_key_hereβββ client/ # React frontend application
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Route-level page components
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utilities and configurations
β βββ public/ # Static assets
βββ server/ # Express backend
β βββ routes/ # API route handlers
β βββ services/ # Business logic services
β βββ middleware/ # Express middleware
β βββ admin/ # Admin portal routes
βββ contracts/ # Smart contracts (Solidity)
βββ shared/ # Shared code (database schema)
βββ script/ # Deployment scripts
βββ migrations/ # Database migrations
- Non-Custodial - Gateway never holds user funds
- Wallet-Controlled - All blockchain transactions require wallet signature
- Service-Oriented - Clean separation of concerns
- Type-Safe - TypeScript throughout
- Secure - API key auth, rate limiting, HMAC webhooks
- β API key authentication
- β Rate limiting (100 requests/minute per API key)
- β HMAC webhook signatures
- β Input validation (Zod schemas)
- β Non-custodial architecture
- β Private keys never exposed
- β Session-based authentication for dashboard
Set DEMO_MODE=true in your .env to enable demo mode:
- No real ARC transactions required
- Mock transaction hashes
- Auto-confirmed payment status
- Perfect for testing and demos
The frontend includes a test mode toggle for switching between demo and live modes.
Non-transferable Soulbound Token (SBT) for verified merchants. Merchants become eligible after their first confirmed payment.
Minimal contract for recording payment receipts on-chain. Provides immutable proof of payment.
See CONTRACT_DEPLOYMENT.md for deployment instructions.
- Create a PostgreSQL database (recommended: Neon)
- Set
DATABASE_URLin.env - Run
npm run db:pushto create tables
See ENV_SETUP_GUIDE.md for complete environment setup.
- Set
DEMO_MODE=falsefor real transactions - Deploy smart contracts to ARC Testnet/Mainnet
- Configure production database
- Set up webhook endpoints
- Configure rate limiting
- Set secure
SESSION_SECRET - Enable HTTPS
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built for the ARC blockchain ecosystem
- Inspired by Stripe and Circle Payments
- Uses OpenZeppelin contracts for secure smart contract development
For issues, questions, or contributions, please open an issue on GitHub.
Built with β€οΈ for the ARC ecosystem