🚀 Getting Started

Welcome to NexusPay, the premier cross-chain wallet infrastructure platform. Our API provides secure, scalable solutions for managing wallets across multiple blockchain networks.

New Authentication System: We've upgraded to user-based authentication with JWT tokens. Legacy API keys are still supported but will be deprecated in 6 months.

Quick Setup

  1. Create Account: Register here for enhanced security and features
  2. Generate API Key: Visit our platform to create secure API keys
  3. Install SDK: npm install @nexuspay/sdk
  4. Start Building: Follow our examples below

🔐 Authentication

NexusPay supports two authentication methods:

1. JWT Token Authentication (Recommended)

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

2. Legacy API Key (Deprecated)

X-API-Key: npay_1234567890abcdef...
Migration Notice: API keys will be deprecated in 6 months. Please migrate to user authentication for enhanced security and features.

👤 User Registration

POST /auth/register

Create a new user account with email validation.

Request Body:

Parameter Type Required Description
email string Yes Valid email address (verified for existence)
password string Yes Strong password (8+ chars, mixed case, numbers, symbols)
name string Yes Full name (2+ characters)

Example Request:

curl -X POST https://backend-amber-zeta-94.vercel.app/auth/register \ -H "Content-Type: application/json" \ -d '{ "email": "developer@example.com", "password": "SecurePass123!", "name": "John Developer" }'
POST /auth/login

Authenticate existing user and receive JWT token.

curl -X POST https://backend-amber-zeta-94.vercel.app/auth/login \ -H "Content-Type: application/json" \ -d '{ "email": "developer@example.com", "password": "SecurePass123!" }'
GET /auth/google

Initiate Google OAuth authentication flow.

🔑 API Key Management

Generate secure API keys for your projects:

Integration Required: API key generation is available on our main platform: https://backend-amber-zeta-94.vercel.app/
POST /api/keys/generate

Generate a new API key for your project.

curl -X POST https://backend-amber-zeta-94.vercel.app/api/keys/generate \ -H "Content-Type: application/json" \ -d '{ "email": "developer@example.com", "projectName": "My DeFi App", "website": "https://myapp.com" }'

💰 Wallet Management

POST /api/wallets

Create a new cross-chain wallet.

curl -X POST https://backend-amber-zeta-94.vercel.app/api/wallets \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "socialId": "user123", "socialType": "discord", "chain": "ethereum" }'
GET /api/wallets/:socialId

Get wallet information for a user.

curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \ https://backend-amber-zeta-94.vercel.app/api/wallets/user123

💸 Payments

POST /api/payments

Process cross-chain payments and transfers.

curl -X POST https://backend-amber-zeta-94.vercel.app/api/payments \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "fromSocialId": "sender123", "toSocialId": "receiver456", "amount": "1.5", "currency": "ETH", "chain": "ethereum" }'

📦 SDK Installation

Installation

npm install @nexuspay/sdk

Basic Setup

import { NexusSDK } from '@nexuspay/sdk'; const sdk = new NexusSDK({ apiKey: 'your-api-key', // or use JWT token environment: 'production', chains: ['ethereum', 'polygon', 'solana'], endpoints: { api: 'https://backend-amber-zeta-94.vercel.app' } }); await sdk.initialize();

💡 Code Examples

Create and Fund Wallet

// Create wallet const wallet = await sdk.createWallet({ socialId: 'user123', socialType: 'discord', chain: 'ethereum' }); // Fund wallet await sdk.fundWallet({ socialId: 'user123', amount: '0.1', currency: 'ETH' });

Cross-chain Transfer

const transfer = await sdk.transfer({ fromSocialId: 'sender123', toSocialId: 'receiver456', amount: '1.0', currency: 'USDC', fromChain: 'ethereum', toChain: 'polygon' }); console.log('Transfer Hash:', transfer.transactionHash);

Authentication with JWT

// Login and get token const auth = await fetch('/auth/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: 'user@example.com', password: 'password123' }) }); const { token } = await auth.json(); // Use token with SDK const sdk = new NexusSDK({ token: token, environment: 'production' });
Ready to get started? Create Account Generate API Key