Skip to main content
An agent that pays for services should know where it stands: how many credits are left on each plan, and how much budget remains on its delegations. This flow pulls that status over the REST API so the agent can warn you — or top up — before it runs dry mid-task.

Useful for

  • A pre-flight check before a run: does the agent have enough credits and delegation budget to finish?
  • A “what do I have” report across every plan you hold and every delegation you’ve granted.
  • Top-up triggers: detect when a balance or budget is low and act before it hits zero.

Try it yourself

You are my autonomous payments agent. Using the Nevermined `nevermined-payments` skill (https://github.com/nevermined-io/docs/tree/main/skills/nevermined-payments) and my NVM_API_KEY, give me a status report of my Nevermined buyer account in sandbox:

1. My payment methods (card and stablecoin), and which are active.
2. My delegations — for each, the spending limit, amount spent, remaining budget, and expiry.
3. For each plan I hold, my remaining credit balance.

Flag anything that's expired, exhausted, or close to running out, and tell me what I'd need to do to top up. Base URL: https://api.sandbox.nevermined.app/api/v1 .

How it works

All three checks are simple authenticated GETs.
1

Payment methods

GET {API_BASE}/payment-methods
Authorization: Bearer <api-key>
Returns your cards and your stablecoin (erc4337) wallet, each with status. The erc4337 method’s id is your wallet/holder address — you’ll use it as the holder when checking plan balances.
2

Delegations and remaining budget

GET {API_BASE}/delegation
Authorization: Bearer <api-key>
Returns { totalResults, page, offset, delegations: [ … ] }, each with spendingLimitCents, amountSpentCents, remainingBudgetCents, status, and expiresAt. (Delegation and transaction lists use totalResults; the plan/agent lists use total — mind the difference if you write one pagination helper for both.) Drill into one delegation’s charges with:
GET {API_BASE}/delegation/{delegationId}/transactions
Authorization: Bearer <api-key>
(returns { totalResults, page, offset, transactions: [ … ] }).
3

Credit balance per plan

For each plan you hold, query your balance with your wallet as the holder:
GET {API_BASE}/protocol/plans/{planId}/balance/{yourAddress}
Authorization: Bearer <api-key>
{yourAddress} is the id of your erc4337 payment method from step 1 (or the userWallet from an embed session). Returns { planName, planType, isSubscriber, balance, pricePerCredit, … }balance is your remaining credits.
The receipt from a purchase (creditsRedeemed / remainingBalance, returned by settle or decoded from the payment-response header) is also a live proof of your balance right after a buy.

Buy access

Top up when a balance runs low.

Enroll a card & delegate

Grant a fresh budget when a delegation is spent or expired.

Order Plans

Buy credits upfront for stablecoin plans.