Skip to main content
This guide covers how to create and manage payment plans using the Nevermined Payments Python SDK.

Overview

Payment Plans define how users pay to access your AI agents and services. Nevermined supports these types of plans:
  • Credits Plans: Users purchase a fixed number of credits that are consumed with each request
  • Time Plans: Users purchase access for a specific duration (e.g., 1 day, 1 month)
  • Pay-As-You-Go Plans: Users pay on every request, in crypto or by card, without buying credits up front

Plans API

Access the Plans API through payments.plans:

Types of Payment Plans

Credits Plans

Credits plans grant users a fixed number of credits. Each agent request consumes credits according to the plan configuration.

Time Plans

Time plans grant users unlimited access for a specific duration:

Pay-As-You-Go Plans

Crypto and card pay-as-you-go plans use different price configs: see Pay-As-You-Go Price.

Trial Plans

Trial plans can only be purchased once per user. Perfect for free trials:

Price Configuration

ERC20 Token Price

Native Token Price (ETH)

Fiat Price (USD)

Fiat Price (EUR)

Fiat amounts are in 6-decimal units (the USDC convention used across the Nevermined protocol), not cents — 10_000_000 = $10.00. The server-side minimum is **$1.00** (1_000_000); smaller amounts are rejected with BCK.PROTOCOL.0047.

EURC Token Price (Euro Stablecoin)

Free Price

Pay-As-You-Go Price

A pay-as-you-go plan charges the subscriber on every request instead of selling a balance of credits up front. Its price builder decides how the subscriber pays, so pick it by rail:
get_pay_as_you_go_price_config always builds a crypto price (is_crypto=True), whatever token you pass. Do not use it for a plan that subscribers pay by card.
What makes either plan pay-as-you-go is the PayAsYouGoTemplate address in its price config: the API reports billingModel: 'pay-as-you-go' (in payments.plans.get_plan(plan_id), and as billing_model on each settle) only for a plan registered on that template. get_pay_as_you_go_price_config (crypto) and get_fiat_pay_as_you_go_price_config (card) set it for you; a plain get_fiat_price_config does not.

Crypto pay-as-you-go

Card pay-as-you-go

Register either one as a credits plan:
A plan built the wrong way still registers without an error, so check the result: payments.plans.get_plan(result["planId"])["billingModel"] must be "pay-as-you-go". A just-registered plan can take a few seconds to read back with its template. A card pay-as-you-go plan:
  • is paid per request through an x402 card delegation: each settle charges the card the plan price, and the settle reports billing_model == "pay-as-you-go" with the charge reference in order_tx (see Was the buyer charged?). A settle that fails with BCK.X402.0048 may already have charged the card: reconcile it, never retry it;
  • is charged in the currency of the buyer’s card delegation (set when the card is enrolled), which the API does not compare with the plan’s currency: keep the two the same;
  • is not sold through checkout, by design: there is no balance to buy up front, so order_fiat_plan fails with BCK.STRIPE.0041;
  • keeps the fiat price floor: the per-request price must be at least $1.00 (1_000_000), otherwise registration fails with BCK.PROTOCOL.0047.
get_fiat_price_config + get_pay_as_you_go_credits_config alone is NOT a pay-as-you-go plan. Without the template address it registers a one-credit credits plan: the API reports it as billingModel: 'credits', and each purchase buys a single credit.

Credits Configuration

Fixed Credits

Each request consumes a fixed number of credits:

Dynamic Credits

Each request can consume a variable number of credits:

Duration-Based (Time Plans)

Retrieve Plans

List Your Plans

List the plans you published. This is caller-scoped account management — it returns only the plans the authenticated account created, never other users’ plans (Nevermined is not a marketplace, so there is no global plan search). Useful for finding and managing your own plans (e.g. spotting duplicates).
For code ported from the TypeScript SDK, get_plans(page, offset, sort_by, sort_order, org_id) is a positional-argument alias of get_user_plans matching plans.getPlans(...) (same defaults: page=1, offset=100, sort_by="created", sort_order="desc").

Get a Single Plan

Get Plan Balance

Check the balance for a specific account:

Get Agents Associated to a Plan

Complete Example

Next Steps

Agents

Register AI agents and associate them with plans

Payments and Balance

Order plans and manage balances