A high-performance cryptocurrency payment processor built in Go with React frontend. Supports real-time payment verification on multiple blockchain networks with automatic settlement and comprehensive transaction management
NOTE: only payment verification is in frontend rn will implement dashboiard and other features asap. the apis are working just not implemented in frontend and swagger will be improved
ONLY FOR EDUCATIONAL AND LEARNING PURPOSES,TRYING TO GET FINTECH RECRUITERS TO NOTICE ME
- Chain Support: BSC,others are placeholders for now
- Real-Time Verification: Automatic blockchain transaction verification
- Payment Processing: Complete order lifecycle (PENDING → PAID → SETTLED)
- QR Code Payments: Generate payment QR codes for mobile wallets
- Auto Settlement: Background settlement with configurable delays
- Double-Entry Ledger: Proper accounting with merchant and clearing buckets
- Idempotent Operations: Safe retry mechanisms and duplicate prevention
- Go
- Node.js
- Git
-
Clone the repository
git clone https://github.com/oxzoid/crypto-payment-processor.git cd crypto-payment-processor
-
Start the development environment
go run ./cmd/server
cd frontend npm run dev
-
Access the application
- Frontend: http://localhost:5173
- Backend API: http://localhost:8080
- Swagger Docs: http://localhost:8080/swagger/
├── cmd/server/ # HTTP server and application entry point
├── pkg/
│ ├── api/ # REST API handlers and middleware
│ ├── blockchain/ # Blockchain integration (BSC, ETH, TRON)
│ └── db/ # Database layer and migrations
├── frontend/ # React TypeScript frontend
└── docs/ # API documentation (Swagger)
All API endpoints require the X-API-Key
header for merchant authentication.
POST /orders
Content-Type: application/json
X-API-Key: your-merchant-api-key
{
"id": "order_123",
"merchant_id": "merchant_abc",
"asset": "USDT",
"chain": "BSC",
"amount_minor": 1000000
}
POST /events/payment-detected
Content-Type: application/json
{
"order_id": "order_123",
"tx_hash": "0xabc123..."
}
GET /orders/get?id=order_123
X-API-Key: your-merchant-api-key
For complete API documentation, visit /swagger/
when running the server.
# Backend Configuration
BSC_RPC_URL=https://bsc-dataseed.binance.org/
DATABASE_URL=file:ospay.db?_pragma=busy_timeout=5000
# Frontend Configuration (optional)
VITE_API_BASE=http://localhost:8080
The application uses SQLite with optimized settings:
- WAL mode for better concurrency
- Foreign key constraints enabled
- Automatic schema migrations
Network | Asset | Contract Address | Status |
---|---|---|---|
BSC | BSC-USD | 0x55d398326f99059fF775485246999027B3197955 |
✅ Verified |
Ethereum | USDT | 0xdAC17F958D2ee523a2206206994597C13D831ec7 |
🔄 Testing/not supported rn |
TRON | USDT | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t |
🔄 Testing/not supported rn |
- API Key Authentication: Secure merchant identification
- Input Validation: Comprehensive request validation
- Idempotent Operations: Safe retry mechanisms
- Transaction Verification: On-chain payment verification
- Rate Limiting: Protection against abuse
- Secure Headers: CORS and security headers configured
GET /debug/metrics
Returns operational metrics including:
- Total orders created
- Payments processed
- Refunds completed
- System health status
GET /health
- Order Creation: Merchant creates order with amount and asset
- QR Generation: System generates payment QR code
- Customer Payment: Customer scans QR and sends payment
- Detection: System detects payment via webhook or polling
- Verification: Blockchain verification confirms payment
- Settlement: Automatic settlement after confirmation period
- Reconciliation: Double-entry ledger maintains balance
go test ./...
# Backend
go build -o server ./cmd/server
# Frontend
cd frontend
npm run build
# Migrations are automatically applied on startup
# Manual application:
go run ./cmd/server
- Database: Consider PostgreSQL for high-throughput scenarios
- Caching: Redis integration for improved performance
- Queue System: External job queue for high-volume processing
- Load Balancing: Multiple server instances with shared database
- Monitoring: Prometheus/Grafana integration available
Build Errors
go mod tidy
go mod download
This project is licensed under GNU AFFERO GENERAL PUBLIC LICENSE- see the LICENSE file for details.
For questions and support:
- Create an issue on GitHub
- Check the API documentation
- Review the troubleshooting section above
Built with using Go and React