# Send Nevermined Payments to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "nevermined-payments",
    "name": "Nevermined Payments",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/aaitor/nevermined-payments",
    "canonicalUrl": "https://clawhub.ai/aaitor/nevermined-payments",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/nevermined-payments",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=nevermined-payments",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "references/a2a-integration.md",
      "references/client-integration.md",
      "references/express-integration.md",
      "references/fastapi-integration.md",
      "references/mcp-paywall.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "nevermined-payments",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-06T03:08:13.497Z",
      "expiresAt": "2026-05-13T03:08:13.497Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=nevermined-payments",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=nevermined-payments",
        "contentDisposition": "attachment; filename=\"nevermined-payments-0.1.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "nevermined-payments"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/nevermined-payments"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/nevermined-payments",
    "downloadUrl": "https://openagent3.xyz/downloads/nevermined-payments",
    "agentUrl": "https://openagent3.xyz/skills/nevermined-payments/agent",
    "manifestUrl": "https://openagent3.xyz/skills/nevermined-payments/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/nevermined-payments/agent.md"
  }
}
```
## Documentation

### Overview

Nevermined provides financial rails for AI agents — real-time monetization, access control, and payments. This skill gives you everything needed to:

Protect API endpoints with the x402 payment protocol
Charge per-request using credit-based billing
Integrate with Express.js, FastAPI, Strands agents, MCP servers, or Google A2A agents
Support subscriber-side flows (purchase plans, generate tokens, call protected APIs)
Enable agent-to-agent payments via the Google A2A protocol

The x402 protocol uses HTTP 402 responses to advertise payment requirements. Clients acquire an access token and retry the request. The server verifies permissions, executes the workload, then settles (burns credits).

### Quick Start Checklist

Get an API key at nevermined.app → Settings → API Keys
Install the SDK (npm install @nevermined-io/payments or pip install payments-py)
Register your agent and plan (via the App UI or programmatically — see references/payment-plans.md)
Add payment protection to your routes/tools (see framework-specific references below)
Test — call without token (expect 402), then with token (expect 200)

### Environment Setup

VariableRequiredDescriptionNVM_API_KEYYesYour Nevermined API key (get it at nevermined.app → Settings → API Keys)NVM_ENVIRONMENTYessandbox for testing, live for productionNVM_PLAN_IDYesThe plan ID from registrationNVM_AGENT_IDSometimesRequired for MCP servers and plans with multiple agentsBUILDER_ADDRESSFor registrationWallet address to receive payments

### .env Template

# Required
NVM_API_KEY=your-api-key-here
NVM_ENVIRONMENT=sandbox
NVM_PLAN_ID=your-plan-id-here

# Required for MCP servers or multi-agent plans
NVM_AGENT_ID=your-agent-id-here

# Required for registration
BUILDER_ADDRESS=0xYourWalletAddress

### Prerequisites

TypeScript/Express.js: Node.js 18+. Your package.json must include "type": "module" for the @nevermined-io/payments/express subpath import to work.
Python/FastAPI: Python 3.9+. Install with pip install payments-py[fastapi] — the [fastapi] extra is required for the middleware.

### TypeScript

npm install @nevermined-io/payments

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

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

### Python

pip install payments-py

import os
from payments_py import Payments, PaymentOptions

payments = Payments.get_instance(
    PaymentOptions(
        nvm_api_key=os.environ["NVM_API_KEY"],
        environment="sandbox"
    )
)

### Core Workflow (All Integrations)

Every Nevermined payment integration follows this 5-step pattern:

Client sends request without a payment token
Server returns 402 with payment-required header (base64-encoded JSON with plan info)
Client acquires x402 token via payments.x402.getX402AccessToken(planId, agentId)
Client retries with payment-signature header containing the token
Server verifies → executes → settles (burns credits), returns response with payment-response header

### Framework Decision Tree

Choose the integration that matches your stack:

FrameworkLanguageReferenceKey ImportExpress.jsTypeScript/JSreferences/express-integration.mdpaymentMiddleware from @nevermined-io/payments/expressFastAPIPythonreferences/fastapi-integration.mdPaymentMiddleware from payments_py.x402.fastapiStrands AgentPythonreferences/strands-integration.md@requires_payment from payments_py.x402.strandsMCP ServerTypeScriptreferences/mcp-paywall.mdpayments.mcp.start() / payments.mcp.registerTool()Google A2ATS / Pythonreferences/a2a-integration.mdpayments.a2a.start() / payments.a2a.buildPaymentAgentCard()Any HTTPAnyreferences/x402-protocol.mdManual verify/settle via facilitator APIClient-sideTS / Pythonreferences/client-integration.mdpayments.x402.getX402AccessToken()

### TypeScript (@nevermined-io/payments)

// Initialize
const payments = Payments.getInstance({ nvmApiKey, environment })

// Register agent + plan
const { agentId, planId } = await payments.agents.registerAgentAndPlan(
  agentMetadata, agentApi, planMetadata, priceConfig, creditsConfig
)

// Subscriber: order plan and get token
await payments.plans.orderPlan(planId)
const balance = await payments.plans.getPlanBalance(planId)
const { accessToken } = await payments.x402.getX402AccessToken(planId, agentId)

// Server: verify and settle
const verification = await payments.facilitator.verifyPermissions({
  paymentRequired, x402AccessToken: token, maxAmount: BigInt(credits)
})
const settlement = await payments.facilitator.settlePermissions({
  paymentRequired, x402AccessToken: token, maxAmount: BigInt(creditsUsed)
})

// Helpers
import { buildPaymentRequired } from '@nevermined-io/payments'
import { paymentMiddleware, X402_HEADERS } from '@nevermined-io/payments/express'

// MCP server
payments.mcp.registerTool(name, config, handler, { credits: 5n })
const { info, stop } = await payments.mcp.start({ port, agentId, serverName })

// A2A server
const agentCard = payments.a2a.buildPaymentAgentCard(baseCard, { paymentType, credits, planId, agentId })
const server = await payments.a2a.start({ port, basePath: '/a2a/', agentCard, executor })
// A2A client
const client = payments.a2a.getClient({ agentBaseUrl, agentId, planId })
await client.sendMessage("Hello", accessToken)

### Python (payments-py)

# Initialize
payments = Payments.get_instance(PaymentOptions(nvm_api_key=key, environment="sandbox"))

# Register agent + plan
result = payments.agents.register_agent_and_plan(
    agent_metadata, agent_api, plan_metadata, price_config, credits_config
)

# Subscriber: order plan and get token
payments.plans.order_plan(plan_id)
balance = payments.plans.get_plan_balance(plan_id)
token_res = payments.x402.get_x402_access_token(plan_id, agent_id)

# Server: verify and settle
verification = payments.facilitator.verify_permissions(
    payment_required=pr, x402_access_token=token, max_amount=str(credits)
)
settlement = payments.facilitator.settle_permissions(
    payment_required=pr, x402_access_token=token, max_amount=str(credits_used)
)

# Helpers
from payments_py.x402.helpers import build_payment_required
from payments_py.x402.fastapi import PaymentMiddleware
from payments_py.x402.strands import requires_payment

# A2A server
from payments_py.a2a.agent_card import build_payment_agent_card
from payments_py.a2a.server import PaymentsA2AServer
agent_card = build_payment_agent_card(base_card, { ... })
server = PaymentsA2AServer.start(agent_card=agent_card, executor=executor, payments_service=payments, port=3005)
# A2A client
client = payments.a2a.get_client(agent_base_url=url, agent_id=agent_id, plan_id=plan_id)

### x402 Payment Headers

All x402 v2 integrations use these three HTTP headers:

HeaderDirectionDescriptionpayment-signatureClient → Serverx402 access tokenpayment-requiredServer → Client (402)Base64-encoded JSON with plan requirementspayment-responseServer → Client (200)Base64-encoded JSON settlement receipt

The payment-required payload structure:

{
  "x402Version": 2,
  "accepts": [{
    "scheme": "nvm:erc4337",
    "network": "eip155:84532",
    "planId": "<plan-id>",
    "extra": { "agentId": "<agent-id>" }
  }]
}

### Payment Plan Types

Nevermined supports several plan types:

Credits-based: prepaid balance, deducted per request (most common for APIs)
Time-based: access for a fixed duration (e.g., 30 days unlimited)
Pay-as-you-go (PAYG): settle in USDC per request, no credit balance
Trial: free limited access, one-time claim per user
Hybrid: combine credits with time expiry

See references/payment-plans.md for plan registration code.

### Express.js — Fixed credits per route

import { paymentMiddleware } from '@nevermined-io/payments/express'

app.use(paymentMiddleware(payments, {
  'POST /ask': { planId: PLAN_ID, credits: 1 },
  'POST /generate': { planId: PLAN_ID, credits: 5 }
}))

### FastAPI — Fixed credits per route

from payments_py.x402.fastapi import PaymentMiddleware

app.add_middleware(
    PaymentMiddleware,
    payments=payments,
    routes={
        "POST /ask": {"plan_id": PLAN_ID, "credits": 1},
        "POST /generate": {"plan_id": PLAN_ID, "credits": 5}
    }
)

### Express.js — Dynamic credits based on response

paymentMiddleware(payments, {
  'POST /generate': {
    planId: PLAN_ID,
    credits: (req, res) => {
      const tokens = res.locals.tokenCount || 100
      return Math.ceil(tokens / 100)
    }
  }
})

### FastAPI — Dynamic credits based on request

async def calculate_credits(request: Request) -> int:
    body = await request.json()
    max_tokens = body.get("max_tokens", 100)
    return max(1, max_tokens // 100)

app.add_middleware(
    PaymentMiddleware,
    payments=payments,
    routes={"POST /generate": {"plan_id": PLAN_ID, "credits": calculate_credits}}
)

### MCP Server — Register tool with paywall

payments.mcp.registerTool(
  "weather.today",
  { title: "Today's Weather", inputSchema: z.object({ city: z.string() }) },
  async (args, extra, context) => ({
    content: [{ type: "text", text: \`Weather in ${args.city}: Sunny, 25C\` }]
  }),
  { credits: 5n }
)

const { info, stop } = await payments.mcp.start({
  port: 3000,
  agentId: process.env.NVM_AGENT_ID!,
  serverName: "my-server"
})

### Strands Agent — Decorator-based payment

from strands import Agent, tool
from payments_py.x402.strands import requires_payment

@tool(context=True)
@requires_payment(payments=payments, plan_id=PLAN_ID, credits=1)
def analyze_data(query: str, tool_context=None) -> dict:
    return {"status": "success", "content": [{"text": f"Analysis: {query}"}]}

agent = Agent(tools=[analyze_data])

### Google A2A — Agent server with payment extension

TypeScript

const agentCard = payments.a2a.buildPaymentAgentCard(baseAgentCard, {
  paymentType: "dynamic",
  credits: 1,
  planId: process.env.NVM_PLAN_ID!,
  agentId: process.env.NVM_AGENT_ID!,
})

const server = await payments.a2a.start({
  port: 3005,
  basePath: '/a2a/',
  agentCard,
  executor: new MyExecutor(),
})

Python

from payments_py.a2a.agent_card import build_payment_agent_card
from payments_py.a2a.server import PaymentsA2AServer

agent_card = build_payment_agent_card(base_agent_card, {
    "paymentType": "dynamic",
    "credits": 1,
    "planId": os.environ["NVM_PLAN_ID"],
    "agentId": os.environ["NVM_AGENT_ID"],
})

server = PaymentsA2AServer.start(
    agent_card=agent_card,
    executor=MyExecutor(),
    payments_service=payments,
    port=3005,
    base_path="/a2a/",
)

### Google A2A — Client sending a paid task

const client = payments.a2a.getClient({
  agentBaseUrl: 'http://localhost:3005/a2a/',
  agentId: AGENT_ID,
  planId: PLAN_ID,
})

const { accessToken } = await payments.x402.getX402AccessToken(PLAN_ID, AGENT_ID)
const response = await client.sendMessage("Analyze this data", accessToken)

### Gathering Developer Information Upfront

When a developer asks you to integrate Nevermined payments, gather ALL required information in a single question before generating code. This avoids multiple back-and-forth interactions.

Ask the developer once for:

Framework: Express.js, FastAPI, MCP server, Strands agent, Google A2A, or generic HTTP?
Routes to protect: Which endpoints need payment protection and how many credits each? (e.g., POST /chat = 1 credit, POST /generate = 5 credits)
Pricing model: Fixed credits per request, or dynamic pricing based on request/response parameters?
Nevermined API Key: Do they already have an NVM_API_KEY? If not, direct them to nevermined.app → Settings → API Keys
Plan ID: Do they already have a NVM_PLAN_ID? If not, do they need a registration script too?
Environment: sandbox (testing) or live (production)?

If they need plan registration, also ask:

Plan name and description: e.g., "Starter Plan — 100 API requests"
Pricing: How much in USDC? (e.g., 10 USDC for 100 credits)
Credits per plan: Total credits included (e.g., 100)
Builder wallet address (BUILDER_ADDRESS): The wallet that receives payments

Example combined prompt to offer the developer:

I need to set up Nevermined payments. Here's my info:

Framework: Express.js
Routes: POST /chat (1 credit), POST /summarize (3 credits)
I need a registration script too
Plan: "Starter Plan", 100 credits for 10 USDC
Environment: sandbox
My API key is in the NVM_API_KEY env var
My wallet: 0x1234...

With this information, generate both the registration script and the payment-protected server in a single response.

### Using the SDK (Recommended)

Register your agent and plan programmatically — see references/payment-plans.md for complete code.

// TypeScript
const { agentId, planId } = await payments.agents.registerAgentAndPlan(
  { name: 'My Agent', description: 'AI service', tags: ['ai'], dateCreated: new Date() },
  { endpoints: [{ POST: 'https://your-api.com/query' }] },
  { name: 'Starter Plan', description: '100 requests for $10', dateCreated: new Date() },
  payments.plans.getERC20PriceConfig(10_000_000n, USDC_ADDRESS, process.env.BUILDER_ADDRESS!),
  payments.plans.getFixedCreditsConfig(100n, 1n)
)

# Python
result = payments.agents.register_agent_and_plan(
    agent_metadata={'name': 'My Agent', 'description': 'AI service', 'tags': ['ai']},
    agent_api={'endpoints': [{'POST': 'https://your-api.com/query'}]},
    plan_metadata={'name': 'Starter Plan', 'description': '100 requests for $10'},
    price_config=get_erc20_price_config(10_000_000, USDC_ADDRESS, os.environ['BUILDER_ADDRESS']),
    credits_config=get_fixed_credits_config(100, 1)
)

### Using the Nevermined App (No-Code)

Go to nevermined.app and sign in
Click "My agents" → register a new agent with metadata and endpoints
Create a payment plan: set pricing, credits, and duration
Link the plan to your agent and publish
Copy the agentId and planId for your .env file

### Using the CLI

# 1. Install CLI
npm install -g @nevermined-io/cli

# 2. Configure (use sandbox for testing)
nvm config init --api-key "$NVM_API_KEY" --environment sandbox

# 3. Register agent and plan together
nvm agents register-agent-and-plan \\
  --agent-metadata '{"name":"My Agent","description":"AI service"}' \\
  --agent-api '{"endpoints":[{"POST":"https://your-api.com/query"}]}' \\
  --plan-metadata '{"name":"Starter Plan","description":"100 requests"}' \\
  --price-config '{"tokenAddress":"0x036CbD53842c5426634e7929541eC2318f3dCF7e","price":10000000,"amountOfCredits":100}' \\
  --credits-config '{"minCreditsRequired":1,"minCreditsToCharge":1,"maxCreditsToCharge":10}'

# 4. List your plans
nvm plans get-plans

# 5. As a subscriber: order a plan and get an x402 token
nvm plans order-plan $PLAN_ID
nvm x402token get-x402-access-token $PLAN_ID --agent-id $AGENT_ID

# 6. Test against your running server
curl -X POST http://localhost:3000/chat \\
  -H "Content-Type: application/json" \\
  -H "payment-signature: $TOKEN" \\
  -d '{"message": "Hello"}'

### Troubleshooting

SymptomCauseFixHTTP 402 returnedNo payment-signature header or invalid/expired tokenGenerate a fresh token via getX402AccessTokenMCP error -32003Payment Required — no token, invalid token, or insufficient creditsCheck subscriber has purchased plan and has credits remainingMCP error -32002Server misconfigurationVerify NVM_API_KEY, NVM_PLAN_ID, and NVM_AGENT_ID are set correctlyverification.isValid is falseToken expired, wrong plan, or insufficient creditsRe-order the plan or generate a new tokenCredits not deductingSettlement not called after requestEnsure you call settlePermissions after processing (middleware does this automatically)payment-required header missingServer not returning 402 properlyUse buildPaymentRequired() helper or framework middleware

### Additional Resources

Documentation: nevermined.ai/docs
Nevermined App: nevermined.app — register agents, create plans, manage subscriptions
MCP Search Server: https://docs.nevermined.app/mcp — search Nevermined docs from any MCP client
Tutorials: github.com/nevermined-io/tutorials
Discord: discord.com/invite/GZju2qScKq
TypeScript SDK: @nevermined-io/payments on npm
Python SDK: payments-py on PyPI
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: aaitor
- Version: 0.1.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-06T03:08:13.497Z
- Expires at: 2026-05-13T03:08:13.497Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/nevermined-payments)
- [Send to Agent page](https://openagent3.xyz/skills/nevermined-payments/agent)
- [JSON manifest](https://openagent3.xyz/skills/nevermined-payments/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/nevermined-payments/agent.md)
- [Download page](https://openagent3.xyz/downloads/nevermined-payments)