Skip to content

How to Enable Nevermined x402 USDC Payments for AI Agents (2026)

Register a Nevermined agent and USDC plan, protect Express with paymentMiddleware, and let buyers pay via erc4337 USDC delegations and x402 access tokens.

Table of Contents

AI agents that charge other agents still trip over the same ops gap: you can return HTTP 402, but you still need a plan, a spend-capped buyer delegation, and a facilitator that verifies before work and settles after.

The named object is Nevermined Payments / Nevermined x402: register an agent plus a USDC ERC-20 plan (sandbox on Base Sepolia, then live), wire Express paymentMiddleware, have buyers createDelegation with provider: 'erc4337' and currency: 'usdc', mint an access token via getX402AccessToken, then verify/settle through Nevermined's facilitator. That is not Coinbase AgentKit as a third-party x402 client, not Circle's public x402 facilitator alone, not Cloudflare Agents MCP paywalls, not Privy agent wallet custody, and not Alchemy gateway auth for RPC credits.

📌
Stablecoin Insider's framing: use this guide when the job is monetizing your own agent/API with Nevermined plans and the nvm:erc4337 x402 scheme (credits + USDC on Base). Use How to Pay for an x402 API with Coinbase AgentKit when the agent only pays someone else's 402. Use How to Enable Circle x402 Facilitator when you want Circle's facilitator URL without Nevermined plans. Use How to Provision Privy Agent Wallets when the hard problem is TEE custody, not plan metering.

Facts below come from Nevermined's 5-minute setup, Nevermined x402, and Express.js integration docs as of September 30, 2026. Code shapes, header names, Base Sepolia USDC address, scheme names, and the BCK.X402.0030 missing-delegationConfig error are taken from those pages. No invented fee schedules or unofficial facilitator URLs.

Key Takeaways

  • Register agent + USDC plan with registerAgentAndPlan; match sandbox: / live: key to environment.
  • Protect Express routes with paymentMiddleware(planId, credits); middleware verifies then settles.
  • Buyers createDelegation(erc4337, usdc) first, then getX402AccessToken with that delegationId.
  • Omit delegationConfig and you hit BCK.X402.0030; reuse one capped delegation across token mints.
  • nvm:erc4337 settles via ERC-4337 UserOps and credits; card-delegation is the fiat sibling scheme.
⚠️
Named downside: sandbox keys against environment: 'live' (or the reverse) hit the wrong backend and fail with confusing 4xxs. Nevermined keys are prefix-scoped (sandbox: → api.sandbox.nevermined.app; live: → api.live.nevermined.app). Treat that match as a hard gate before you debug signatures.

Who this is for

Use this path if you expose an agent API, MCP tool, or protected HTTP resource, you want buyers to pay in USDC (or credits backed by a USDC plan) under spend caps, and you can run TypeScript Express or Python FastAPI with the Nevermined Payments SDK.

Skip it if you are only paying third-party x402 merchants (see How to Pay for an x402 API with Coinbase AgentKit), standing up Circle's facilitator without Nevermined plans (see How to Enable Circle x402 Facilitator for USDC), charging MCP tools on Cloudflare (see How to Charge for MCP Tools with Cloudflare Agents x402), provisioning TEE wallets (see How to Provision Privy Agent Wallets for USDC), or authenticating Alchemy RPC with x402 (see How to Authenticate Alchemy APIs with x402 USDC). For picking among facilitators, see How to Choose an x402 Facilitator for USDC. For generic accept-side patterns, see How to Accept x402 USDC Payments from AI Agents.

What Nevermined x402 means for USDC agent payments

Standard x402 focuses on EIP-3009-style pay-per-request ERC-20 transfers. Nevermined keeps the HTTP 402 handshake (payment-required / payment-signature / payment-response) and extends settlement with ERC-4337 smart accounts, session keys, and plan credits. The crypto scheme is nvm:erc4337 on networks such as eip155:84532 (Base Sepolia in the docs' examples). The fiat sibling is nvm:card-delegation (Stripe / Braintree / Visa).

Operators care about three objects: the agent (your monetizable service), the plan (price + credits or time window), and the buyer's delegation (spendingLimitCents, durationSecs, provider, currency). Settlement burns credits after work succeeds. With a live delegation, the facilitator can also top up credits automatically up to the cap, so buyers are not stuck in a manual orderPlan loop for every request.

MPP is the sibling wire format. Same plans, credits, and delegation; different handshake (WWW-Authenticate: Payment instead of an x402 accepts body). This guide stays on x402 USDC / nvm:erc4337.

Prerequisites and environment matching

Create an API key in nevermined.app under Settings → Global NVM API Keys. Nevermined documents two prefixes and backends:

Key prefixSDK environmentBackend
sandbox:sandboxapi.sandbox.nevermined.app
live:liveapi.live.nevermined.app

Install the SDK: npm install @nevermined-io/payments (TypeScript) or pip install payments-py (Python). Keep a builder wallet address for USDC payouts on the plan. For sandbox USDC on Base Sepolia, Nevermined's 5-minute setup uses contract 0x036CbD53842c5426634e7929541eC2318f3dCF7e. Mainnet Base USDC is commonly 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913; confirm the address Nevermined's live plan config expects before you fund production.

Step 1: Register the agent and a USDC plan

Call payments.agents.registerAgentAndPlan with service metadata, an endpoint map, plan metadata, an ERC-20 price config, and a fixed-credits config. The 5-minute setup example prices 10 USDC (10_000_000 base units at 6 decimals) for 100 requests at 1 credit each.

TypeScript shape (from Nevermined's docs): initialize Payments.getInstance({ nvmApiKey, environment: 'sandbox' }), then pass getERC20PriceConfig(10_000_000n, USDC_ADDRESS, BUILDER_ADDRESS) plus getFixedCreditsConfig(100n, 1n). Persist the returned agentId and planId. You can also create agents and plans in the Nevermined App without code; the IDs still land in the same middleware.

Stablecoin Insider's operator note: register in sandbox first, hit the 402 path with a buyer key, then promote the same structure to live with a live: key. Do not mix sandbox plan IDs into a live Express process.

Step 2: Wire Express paymentMiddleware

For Express, Nevermined ships paymentMiddleware from @nevermined-io/payments/express. One middleware registration protects routes; handlers stay payment-free.

Minimal pattern from the Express guide: app.use(paymentMiddleware(payments, { 'POST /ask': { planId: PLAN_ID, credits: 1 } })). The middleware returns 402 with a payment-required header when the client omits payment-signature, verifies the token with the facilitator before your handler runs, burns credits on settle, and attaches a payment-response receipt. Route config also supports dynamic credits (for example based on token count), path parameters, and an explicit agentId when one plan covers multiple agents.

Manual path (any framework): build paymentRequired with buildPaymentRequired(PLAN_ID, { endpoint, agentId, httpVerb }); if no payment-signature, return 402 with base64 payment-required; else facilitator.verifyPermissions, run work, then facilitator.settlePermissions. Nevermined is explicit: verify does not burn credits; settle does.

💡
Stablecoin Insider's take: prefer paymentMiddleware in production Express. Hand-rolled verify/settle is fine for non-Express stacks, but teams that reimplement header encoding usually recreate the same bugs Nevermined already fixed (scheme detection, billingModel on pay-as-you-go receipts, settle-after-success ordering).

Step 3: Buyer createDelegation (erc4337 / usdc) + getX402AccessToken

Buyers do not paste raw private keys into the agent. They create a spend-capped delegation, then mint short-lived x402 access tokens against it.

Required create-first flow (docs as of 2026): payments.delegation.createDelegation({ provider: 'erc4337', spendingLimitCents, durationSecs, currency: 'usdc' }), then payments.x402.getX402AccessToken(planId, agentId, { scheme: 'nvm:erc4337', delegationConfig: { delegationId } }). Reuse the same delegationId for subsequent token mints until the cap or duration expires. Inline create-on-the-fly fields inside delegationConfig are deprecated and warn at runtime.

If delegationConfig is missing, Nevermined surfaces BCK.X402.0030 at runtime. Treat that code as a configuration bug, not a chain outage. For fiat plans, create the delegation with a card provider and currency: 'usd', and pass scheme: 'nvm:card-delegation'; buyer-side getX402AccessToken defaults to crypto and will not auto-detect fiat.

Send the token on the next request:

payment-signature: <accessToken>

Optional orderPlan still works for an initial credit balance, but with a valid USDC/card delegation the facilitator can top up at settle time up to spendingLimitCents. That is the difference between a demo curl and an autonomous buyer agent.

Step 4: Verify, execute, settle

Server-side verify checks envelope structure, EIP-712 signature / session keys, UserOp simulation, delegated permissions (burn/order/redeem), and plan balance. On failure, return 402. On success, run the paid workload, then settle with the credits actually consumed. Include billingModel in the settlement receipt you echo back: on pay-as-you-go plans credit fields can read "0", so buyers need billingModel to tell a real charge from a no-op credits settle.

Ops checklist Stablecoin Insider recommends before live:

  • Curl without payment-signature; expect 402 + payment-required.
  • Mint a capped sandbox delegation ($10 / 1 day is the docs' example scale; see Nevermined 5-minute setup) and retry with payment-signature.
  • Confirm creditsRemaining (or billingModel receipt) moves after settle.
  • Revoke the delegation and confirm further settles fail.
  • Only then switch to a live: key and mainnet plan IDs.

Spend caps, credits, and sandbox vs live

Delegations are the control plane. spendingLimitCents and durationSecs bound what an autonomous buyer can burn without a human in the loop. Credits on the plan are the metering unit your agent burns per request; USDC on the plan is how those credits get funded. Do not confuse "direct USDC per request" EIP-3009 x402 with Nevermined's credits + smart-account settle. Both speak HTTP 402; the settlement model differs.

Sandbox is for integration tests on Base Sepolia USDC. Live is production. Promote plans deliberately. If you need to fund a buyer wallet before first purchase, see How to Fund an AI Agent Wallet with USDC. If you need Stripe-shaped machine payments without Nevermined plans, see How to Accept Stripe MPP Payments in USDC.

How Nevermined compares to other x402 stacks

StackWhat it optimizesWhen Stablecoin Insider picks it
Coinbase AgentKit x402Buyer-side agent paying third-party 402 APIsYour agent is the payer, not the merchant of record
Circle x402 facilitatorFacilitator verify/settle for USDC without Nevermined plansYou want Circle's facilitator URL and your own resource server
Cloudflare Agents MCP x402MCP tool paywalls on Cloudflare Workers/AgentsThe product is MCP tools, not a generic Express API
Privy agent walletsTEE custody + policy engine for agent keysKey custody and allowlists are the hard problem
Alchemy x402 USDC authPay Alchemy APIs with x402 USDCThe merchant is Alchemy itself
Nevermined Payments x402Plans, credits, erc4337 delegations, Express/FastAPI middlewareYou are the merchant metering agent/API usage under spend caps

For a broader facilitator shortlist, use How to Choose an x402 Facilitator for USDC. Nevermined wins when you need plan objects, credit metering, and capped buyer delegations in one SDK. It is heavier than a bare facilitator URL if you only need a single EIP-3009 transfer per request.

Stablecoin Insider's take

💬
Stablecoin Insider's take: Nevermined is the right default when your agent is the merchant of record and you need USDC-backed plans with spend-capped buyer agents. Start on sandbox with paymentMiddleware, force every buyer through createDelegation(erc4337/usdc), and treat BCK.X402.0030 as a ship-blocker in CI. If you only need to pay someone else's 402, AgentKit (or Privy createX402Client) is leaner. If you only need Circle's facilitator without Nevermined plans, use Circle's path and skip the plan registry.

FAQ

What is Nevermined x402 USDC used for?

It lets AI agents and APIs charge per request over HTTP 402 using Nevermined payment plans, with crypto settlement on the nvm:erc4337 scheme (USDC-backed credits and smart-account UserOps) or fiat via nvm:card-delegation.

How do I enable Nevermined paymentMiddleware on Express?

Install @nevermined-io/payments, initialize Payments.getInstance with a matching sandbox/live key, then app.use(paymentMiddleware(payments, { 'POST /ask': { planId, credits: 1 } })). Handlers stay free of payment logic.

Why do I see BCK.X402.0030 when minting an access token?

Nevermined requires delegationConfig (create a delegation first, then pass { delegationId }). Omitting it surfaces BCK.X402.0030. Also match provider: 'erc4337' with currency: 'usdc' for crypto plans.

Should I use sandbox or live for the first integration?

Sandbox. Use a sandbox: API key, Base Sepolia USDC (0x036CbD53842c5426634e7929541eC2318f3dCF7e in Nevermined's quickstart), and only promote plan/agent IDs to a live: key after 402 → pay → settle works end to end.

How is Nevermined different from Coinbase AgentKit x402?

AgentKit is primarily a buyer-side toolkit for paying third-party x402 APIs. Nevermined Payments is merchant-side plans + facilitator verify/settle + buyer delegations. Many stacks use both: Nevermined to sell, AgentKit or Privy clients to buy.

Do credits replace USDC?

Credits are the metering unit burned at settle. USDC (or a card) funds the plan that issues those credits. Direct EIP-3009 USDC-per-request x402 is a different settlement model than Nevermined's credits + nvm:erc4337 UserOps.

Can buyers skip orderPlan if they have a delegation?

Yes for many flows. Nevermined documents that a valid delegation lets the facilitator top up credits at settlement up to spendingLimitCents, so autonomous buyers are not stuck calling orderPlan before every request.

Where do I put the access token on the request?

In the payment-signature header. Servers advertise requirements in payment-required on 402 responses and return settlement proof in payment-response.


Need the facilitator shortlist before you ship? Start with Stablecoin Insider's x402 facilitator comparison, then come back to this Nevermined wire-up.

Choose an x402 facilitator
How to Choose an x402 Facilitator for USDC (2026)
Compare x402 facilitator options for USDC agent and API payments.

This content is provided for informational and educational purposes only and does not constitute financial, investment, legal, or tax advice; no material herein should be interpreted as a recommendation, endorsement, or solicitation to buy or sell.

Latest