Skip to main content

Node.js SDK Introduction

The Easy Node.js SDK (@easylabs/node) provides a comprehensive, type-safe solution for server-side payment processing, customer management, and e-commerce functionality.

Features

🚀 Server-Side Payment Processing

Process payments securely from your backend with full control over the payment flow.

🔒 Secure API

Your secret API key stays on the server, never exposed to clients.

💼 Complete E-commerce

  • Customer management
  • Payment instruments
  • Transfers and refunds
  • Product catalog and pricing
  • Subscription management
  • Order tracking
  • Settlement and dispute handling

🏗️ Framework Integration

Works seamlessly with:

  • Express.js
  • Next.js API Routes
  • Fastify
  • Koa
  • Any Node.js environment

📱 TypeScript Support

Comprehensive TypeScript definitions with full type safety for all API methods and data structures.

Architecture

The Node.js SDK operates in the server-side environment:

┌──────────────────────────────────┐
│ Your Node.js Server │
│ ┌────────────────────────────┐ │
│ │ Easy Client Instance │ │
│ │ - Customer Management │ │
│ │ - Payment Processing │ │
│ │ - Product Management │ │
│ │ - Subscription Mgmt │ │
│ │ - Order Management │ │
│ └────────────────────────────┘ │
└──────────────────────────────────┘

│ HTTPS (Secure)

┌──────────▼──────────────────────┐
│ Easy API │
│ - Payment Processing │
│ - Data Storage │
│ - Compliance │
└─────────────────────────────────┘

When to Use Node.js SDK

Use the Node.js SDK for:

  • ✅ Server-side payment processing
  • ✅ Backend API routes
  • ✅ Webhook handlers
  • ✅ Batch operations
  • ✅ Administrative tasks
  • ✅ Reporting and analytics
Best Practice

Use the Node.js SDK in combination with the React SDK for full-stack applications. Let the React SDK handle tokenization and UI, while the Node.js SDK processes payments on your server.

Requirements

  • Node.js 20.0 or higher
  • npm, yarn, or pnpm

Supported Environments

  • ✅ Express.js
  • ✅ Next.js (App Router & Pages Router)
  • ✅ Fastify
  • ✅ Koa
  • ✅ AWS Lambda
  • ✅ Vercel Serverless Functions
  • ✅ Cloudflare Workers (with polyfills)
  • ✅ Any Node.js runtime

Security Considerations

Secret API Key

Your secret API key must NEVER be exposed in client-side code or committed to version control. Always use environment variables.

// ✅ Good - Server-side only
const easy = await createClient({
apiKey: process.env.EASY_API_KEY, // From environment variable
});

// ❌ Bad - Never do this
const easy = await createClient({
apiKey: "easy_sk_123...", // Hardcoded key
});

Next Steps

  1. Install the Node.js SDK
  2. Follow the Quick Start guide
  3. Explore API Reference
  4. View Examples