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

Initialization

import os
from payments_py import Payments, PaymentOptions

payments = Payments.get_instance(
    PaymentOptions(
        nvm_api_key=os.environ['NVM_API_KEY'],
        environment='sandbox'  # or 'live'
    )
)

Singleton Pattern

The SDK uses a singleton pattern. Call get_instance() to get or create the instance:
# First call creates the instance
payments1 = Payments.get_instance(options)

# Subsequent calls return the same instance
payments2 = Payments.get_instance()
# payments1 is 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
agents = payments.agents
plans = payments.plans
requests = payments.requests

# Or access directly
agent = payments.agents.get_agent('did:nv:...')
plan = payments.plans.get_plan('did:nv:...')

PaymentOptions

class PaymentOptions:
    nvm_api_key: str
    environment: str  # 'sandbox' | 'live'
    app_id: Optional[str] = None
    version: Optional[str] = None

Next Steps