Skip to main content
The Payments class is the main entry point for all Nevermined payment operations.

Initialization

import { Payments } from '@nevermined-io/payments'

const payments = Payments.getInstance({
  nvmApiKey: process.env.NVM_API_KEY!,
  environment: 'sandbox' // or 'live'
})

Singleton Pattern

The SDK uses a singleton pattern. Call getInstance() to get or create the instance:
// First call creates the instance
const payments1 = Payments.getInstance(config)

// Subsequent calls return the same instance
const payments2 = Payments.getInstance()
// payments1 === payments2

Available Modules

The Payments class exposes several modules:
ModuleDescription
payments.agentsAgent registration and management
payments.plansPayment plan operations
payments.requestsRequest validation
payments.x402x402 protocol support
payments.facilitatorx402 verification and settlement
payments.a2aGoogle A2A integration
payments.mcpMCP server integration

Module Access

// Access modules via the payments instance
const { agents, plans, requests, x402, facilitator } = payments

// Or access directly
const agent = await payments.agents.getAgent('did:nv:...')
const plan = await payments.plans.getPlan('did:nv:...')

Type Definitions

interface PaymentsConfig {
  nvmApiKey: string
  environment: 'sandbox' | 'live'
  appId?: string
  version?: string
}

Next Steps