A non-custodial cryptocurrency payment gateway for e-commerce that enables merchants to accept crypto payments with automatic fee handling and real-time transaction monitoring.
- Multi-Chain Support: Bitcoin, Bitcoin Cash, Ethereum, Polygon, Solana, and USDC across major blockchains
- Non-Custodial: Merchants maintain full control of their funds
- Real-Time Processing: Instant payment detection and forwarding (no batching)
- Automatic Fee Handling: 0.5% platform fee automatically deducted during forwarding
- Multi-Business Support: Manage multiple businesses under one merchant account
- Wallet Integration: Connect MetaMask, WalletConnect, or Phantom wallet
- QR Code Payments: Easy-to-integrate payment QR codes
- Webhook Notifications: Real-time payment callbacks for your system
- CLI & SDK: Command-line interface and ESM module for programmatic integration
- Exchange Rates: Real-time crypto/fiat rates via Tatum API
- Starter Plan (Free): Up to 100 transactions/month, all supported chains, basic API access, email support
- Professional Plan ($49/month): Unlimited transactions, priority support, advanced analytics, custom webhooks, white-label option
- Crypto Payments for Subscriptions: Pay for upgrades using BTC, BCH, ETH, POL, or SOL
- Usage Tracking: Real-time transaction counting with automatic limit enforcement
- Feature Gating: API-level enforcement of plan-specific features
- Platform Payments: Collect subscription fees and service charges from businesses
- 100% Forwarding: Business collection payments forward entirely to platform wallets
- Multiple Blockchains: Support for BTC, BCH, ETH, POL, SOL
CoinPay uses a modern, scalable architecture:
- Frontend: Next.js 14+ with TypeScript and TailwindCSS
- Backend: Next.js API Routes (serverless)
- Database: Supabase (PostgreSQL)
- Blockchain: Self-hosted wallet generation with RPC provider monitoring
- Testing: Vitest for unit and integration tests
See Architecture Documentation for detailed system design.
- Node.js 18+ and npm/yarn/pnpm
- Supabase account (free tier available)
- RPC provider accounts (Alchemy, Infura, or public nodes)
- Tatum API key (for exchange rates)
- Clone the repository:
git clone https://github.com/yourusername/coinpayportal.git
cd coinpayportal- Install dependencies:
npm install- Copy environment variables:
cp .env.example .env.local- Configure your
.env.localfile with required credentials:
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# Encryption
ENCRYPTION_KEY=your_32_byte_encryption_key
# RPC Providers
BITCOIN_RPC_URL=https://your-bitcoin-rpc
ETHEREUM_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY
POLYGON_RPC_URL=https://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
# Platform Fee Wallets
PLATFORM_FEE_WALLET_BTC=your_btc_address
PLATFORM_FEE_WALLET_ETH=your_eth_address
PLATFORM_FEE_WALLET_POL=your_pol_address
PLATFORM_FEE_WALLET_SOL=your_sol_address
# Tatum API
TATUM_API_KEY=your_tatum_api_key
# Webhook
WEBHOOK_SIGNING_SECRET=your_webhook_secret- Set up the database:
npm run db:setup- Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
- Architecture Overview
- API Documentation
- Database Schema
- Subscriptions & Entitlements
- Business Collection
- Security Best Practices
const response = await fetch('/api/payments/create', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
businessId: 'your-business-id',
amount: 100.00,
currency: 'USD',
blockchain: 'eth',
merchantWalletAddress: '0x...',
metadata: {
orderId: 'ORDER-123',
customerEmail: 'customer@example.com'
}
})
});
const payment = await response.json();
// Returns: { id, address, qrCode, amount, expiresAt }# Create a payment
coinpay payment create \
--business-id abc123 \
--amount 100 \
--currency USD \
--blockchain eth \
--wallet 0x...
# Check payment status
coinpay payment status --id payment_xyz
# List businesses
coinpay business list
# Configure webhook
coinpay webhook set --url https://yoursite.com/webhookimport { CoinPay } from '@coinpayportal/sdk';
const client = new CoinPay({
apiKey: 'your-api-key',
environment: 'production'
});
// Create payment
const payment = await client.payments.create({
businessId: 'your-business-id',
amount: 100,
currency: 'USD',
blockchain: 'eth',
merchantWalletAddress: '0x...'
});
// Monitor payment
client.payments.on('confirmed', (payment) => {
console.log('Payment confirmed:', payment.id);
});<!-- Simple integration -->
<div id="coinpay-widget"
data-business-id="your-business-id"
data-amount="100"
data-currency="USD"
data-blockchain="eth">
</div>
<script src="https://coinpayportal.com/widget.js"></script>- Private keys are encrypted at rest using AES-256
- All API routes require authentication
- Rate limiting on all endpoints
- Webhook signatures for verification
- Multi-confirmation requirements before forwarding
- See Security Documentation for details
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
# Run E2E tests
npm run test:e2ecoinpayportal/
βββ docs/ # Documentation
β βββ ARCHITECTURE.md
β βββ API.md
β βββ DATABASE.md
β βββ SUBSCRIPTIONS.md # Subscription plans & entitlements
β βββ BUSINESS_COLLECTION.md
β βββ SECURITY.md
βββ src/
β βββ app/ # Next.js app directory
β β βββ api/ # API routes
β β β βββ auth/ # Authentication endpoints
β β β βββ payments/ # Payment endpoints
β β β βββ businesses/ # Business management
β β β βββ business-collection/ # Platform payments
β β β βββ subscriptions/ # Subscription management
β β β βββ entitlements/ # Entitlements API
β β βββ dashboard/ # Merchant dashboard
β β βββ pricing/ # Pricing & upgrade page
β β βββ docs/ # API documentation page
β β βββ page.tsx # Landing page
β βββ components/ # React components
β β βββ business/ # Business management components
β β βββ docs/ # Documentation components
β βββ lib/ # Utility libraries
β β βββ auth/ # Authentication services
β β βββ blockchain/ # Blockchain services
β β βββ business/ # Business services
β β βββ entitlements/ # Entitlements & usage tracking
β β βββ payments/ # Payment processing
β β βββ subscriptions/ # Subscription management
β β βββ supabase/ # Supabase client
β β βββ crypto/ # Encryption utilities
β βββ types/ # TypeScript types
βββ supabase/
β βββ migrations/ # Database migrations
βββ cli/ # CLI package
βββ sdk/ # SDK package
βββ package.json
- Core payment processing
- Multi-chain support (BTC, BCH, ETH, POL, SOL, USDC)
- Merchant dashboard
- Webhook system
- Subscription plans (Starter/Professional)
- Entitlements & usage tracking
- Business collection payments
- Crypto-based subscription payments
- Mobile SDK
- WooCommerce plugin
- Shopify app
- Recurring payments (auto-renewal)
- Fiat off-ramp
- Advanced analytics dashboard
Contributions are welcome! Please read our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: coinpayportal.com/docs
- Email: support@coinpayportal.com
- Discord: Join our community
- GitHub Issues: Report a bug
- Next.js - React framework
- Supabase - Backend as a service
- Tatum - Blockchain API and exchange rates
- Alchemy - Blockchain infrastructure
- WalletConnect - Wallet connection protocol
Built with β€οΈ by the CoinPay team