📦 Node.js SDK & CLI
Use our official SDK for seamless integration with your Node.js applications
Authentication
All API requests require authentication using a JWT token in the Authorization header.
/api/auth/registerCreate a new merchant account.
Request Body
{
"email": "merchant@example.com",
"password": "SecurePassword123!",
"name": "My Business" // optional
}cURL Example
curl -X POST https://coinpayportal.com/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "merchant@example.com",
"password": "SecurePassword123!",
"name": "My Business"
}'Node.js Example
const response = await fetch('https://coinpayportal.com/api/auth/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: 'merchant@example.com',
password: 'SecurePassword123!',
name: 'My Business'
})
});
const data = await response.json();
console.log(data.token); // Save this token/api/auth/loginLogin to get an authentication token.
Request Body
{
"email": "merchant@example.com",
"password": "SecurePassword123!"
}Response
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"merchant": {
"id": "merchant-123",
"email": "merchant@example.com",
"name": "My Business"
}
}/api/auth/meGet current authenticated merchant information.
cURL Example
curl https://coinpayportal.com/api/auth/me \ -H "Authorization: Bearer YOUR_TOKEN"
Response
{
"success": true,
"merchant": {
"id": "merchant-123",
"email": "merchant@example.com",
"name": "My Business",
"created_at": "2024-01-01T12:00:00Z"
}
}Subscriptions & Entitlements
CoinPay Portal offers two subscription tiers with different features and transaction limits. All subscription payments are processed using cryptocurrency.
Tip: View our pricing page for a visual comparison of plans and to upgrade your subscription.
Subscription Plans
- • Up to 100 transactions/month
- • All supported chains
- • Basic API access
- • Email support
- • Unlimited transactions
- • Priority support
- • Advanced analytics
- • Custom webhooks
- • White-label option
/api/subscription-plansGet available subscription plans (public endpoint).
Response
{
"success": true,
"plans": [
{
"id": "starter",
"name": "Starter",
"description": "Perfect for testing and small projects",
"pricing": { "monthly": 0, "yearly": 0 },
"limits": { "monthly_transactions": 100, "is_unlimited": false },
"features": {
"all_chains_supported": true,
"basic_api_access": true,
"advanced_analytics": false,
"custom_webhooks": false,
"white_label": false,
"priority_support": false
}
},
{
"id": "professional",
"name": "Professional",
"pricing": { "monthly": 49, "yearly": 490 },
"limits": { "monthly_transactions": null, "is_unlimited": true },
"features": { ... }
}
]
}/api/entitlementsGet current merchant's entitlements, features, and usage.
cURL Example
curl https://coinpayportal.com/api/entitlements \ -H "Authorization: Bearer YOUR_TOKEN"
Response
{
"success": true,
"entitlements": {
"plan": {
"id": "starter",
"name": "Starter",
"description": "Perfect for testing and small projects",
"price_monthly": 0
},
"features": {
"all_chains_supported": true,
"basic_api_access": true,
"advanced_analytics": false,
"custom_webhooks": false,
"white_label": false,
"priority_support": false
},
"usage": {
"transactions_this_month": 45,
"transaction_limit": 100,
"transactions_remaining": 55,
"is_unlimited": false
},
"status": "active"
}
}/api/subscriptions/checkoutCreate a crypto payment for subscription upgrade.
Request Body
{
"plan_id": "professional",
"billing_period": "monthly", // or "yearly"
"blockchain": "ETH" // BTC, BCH, ETH, MATIC, SOL
}cURL Example
curl -X POST https://coinpayportal.com/api/subscriptions/checkout \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "professional",
"billing_period": "monthly",
"blockchain": "ETH"
}'Response
{
"success": true,
"payment": {
"id": "pay_abc123",
"payment_address": "0x1234...5678",
"amount": 49,
"currency": "USD",
"blockchain": "ETH",
"expires_at": "2024-01-15T12:00:00Z"
},
"plan": {
"id": "professional",
"name": "Professional",
"billing_period": "monthly",
"price": 49
},
"instructions": "Send exactly $49 worth of ETH to the payment address..."
}/api/subscriptions/statusGet current subscription status.
Response
{
"success": true,
"subscription": {
"planId": "professional",
"status": "active",
"startedAt": "2024-01-01T00:00:00Z",
"endsAt": "2024-02-01T00:00:00Z",
"isActive": true,
"daysRemaining": 15
}
}/api/subscriptions/statusCancel subscription (access continues until end of billing period).
Response
{
"success": true,
"message": "Subscription cancelled. You will retain access until the end of your billing period.",
"subscription": {
"planId": "professional",
"status": "cancelled",
"endsAt": "2024-02-01T00:00:00Z",
"isActive": true,
"daysRemaining": 15
}
}Entitlement Error Codes
Businesses
/api/businessesList all businesses for the authenticated merchant.
cURL Example
curl https://coinpayportal.com/api/businesses \ -H "Authorization: Bearer YOUR_TOKEN"
/api/businessesCreate a new business.
Request Body
{
"name": "My Store",
"description": "Online retail store", // optional
"wallet_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"webhook_url": "https://mystore.com/webhook" // optional
}Node.js Example
const response = await fetch('https://coinpayportal.com/api/businesses', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'My Store',
wallet_address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
})
});
const data = await response.json();/api/businesses/:idUpdate an existing business.
/api/businesses/:idDelete a business.
Payments
/api/payments/createCreate a new payment request.
Request Body
{
"business_id": "business-123",
"amount_usd": 100.00,
"currency": "btc", // btc, eth, matic, sol
"description": "Order #12345" // optional
}cURL Example
curl -X POST https://coinpayportal.com/api/payments/create \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"business_id": "business-123",
"amount_usd": 100.00,
"currency": "btc"
}'Response
{
"success": true,
"payment": {
"id": "payment-456",
"business_id": "business-123",
"amount_usd": "100.00",
"amount_crypto": "0.00234567",
"currency": "btc",
"payment_address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"status": "pending",
"created_at": "2024-01-01T12:00:00Z",
"expires_at": "2024-01-01T13:00:00Z"
}
}/api/payments/:idRetrieve payment details by ID.
Node.js Example
const response = await fetch('https://coinpayportal.com/api/payments/payment-456', {
headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
});
const data = await response.json();
console.log(data.payment.status);/api/payments/:id/qrGet QR code image for payment address.
Usage
<img src="https://coinpayportal.com/api/payments/payment-456/qr"
alt="Payment QR Code" />Business Collection
Business Collection payments allow the platform to collect payments from business users (subscription fees, service charges, etc.) with 100% forwarding to platform wallets.
Key Difference: Unlike regular payments (99.5% merchant / 0.5% platform), Business Collection forwards 100% of funds to the platform's collection wallet.
/api/business-collectionCreate a new business collection payment.
Request Body
{
"business_id": "business-123",
"amount": 99.99,
"currency": "USD",
"blockchain": "ETH", // BTC, BCH, ETH, MATIC, SOL
"description": "Monthly subscription fee",
"metadata": {
"plan": "premium",
"billing_period": "2024-01"
}
}Response
{
"success": true,
"payment": {
"id": "collection-456",
"payment_address": "0x1234...5678",
"amount": 99.99,
"currency": "USD",
"blockchain": "ETH",
"destination_wallet": "0xplatform...wallet",
"status": "pending",
"description": "Monthly subscription fee",
"expires_at": "2024-01-02T12:00:00Z",
"created_at": "2024-01-01T12:00:00Z"
}
}/api/business-collectionList business collection payments with optional filters.
Query Parameters
business_id - Filter by business (optional)
status - Filter by status: pending, confirmed, forwarded (optional)
limit - Results per page, default 50 (optional)
offset - Pagination offset (optional)
/api/business-collection/:idGet details of a specific business collection payment.
Collection Payment Statuses
pendingWaiting for payment
detectedPayment detected on blockchain
confirmedPayment confirmed
forwardingForwarding to platform wallet
forwarded100% forwarded to platform
expiredPayment request expired
Dashboard
/api/dashboard/statsGet payment statistics and recent activity.
Response
{
"success": true,
"stats": {
"total_payments": 150,
"successful_payments": 142,
"pending_payments": 5,
"failed_payments": 3,
"total_volume": "0.12345678",
"total_volume_usd": 5234.56
},
"recent_payments": [...]
}Settings
/api/settingsGet merchant notification settings.
/api/settingsUpdate notification preferences.
Request Body
{
"notifications_enabled": true,
"email_notifications": true,
"web_notifications": false
}Supported Cryptocurrencies
btcethmaticsolWebhooks
Configure webhook URLs in your business settings to receive real-time payment notifications.
Webhook Events
payment.detectedPayment detected on blockchain (0 confirmations)
payment.confirmedPayment confirmed (sufficient confirmations)
payment.forwardedPayment forwarded to merchant wallet
payment.failedPayment failed or expired
Webhook Payload Example
{
"event": "payment.confirmed",
"payment_id": "payment-456",
"business_id": "business-123",
"amount_crypto": "0.00234567",
"amount_usd": "100.00",
"currency": "btc",
"status": "confirmed",
"confirmations": 3,
"tx_hash": "abc123...",
"timestamp": "2024-01-01T12:05:00Z"
}Note: Webhook payloads are signed with HMAC-SHA256. Verify the signature using your webhook secret.
Rate Limits & Fees
Rate Limits
• API Requests: 100 requests/minute
• Payment Creation: 10 payments/minute
• Webhook Retries: 3 attempts with exponential backoff
Platform Fees
• Platform Fee: 0.5% per transaction
• Network Fees: Paid by customer
• Minimum Payment: $1.00 USD
Error Codes
Error Response Format
{
"success": false,
"error": "Detailed error message here"
}