Delegation

Create a spending delegation and return a signed JWT token

Creates a spending delegation for the authenticated user against a previously enrolled payment method. For fiat-backed delegations (stripe/braintree/visa) the response includes a signed JWT (delegationToken); for crypto (erc4337) flows the token is held client-side and omitted. Requires a Nevermined API key.

post/delegation/create

Request

  • Base URL: https://api.sandbox.nevermined.app/api/v1
  • URL: https://api.sandbox.nevermined.app/api/v1/delegation/create
  • Auth: HTTP bearer

Request body

provider'stripe' | 'erc4337' | 'braintree' | 'visa' | 'vgs' required

Payment provider type. stripe / braintree / visa / erc4337 select that rail directly. vgs (epic #1958) is a unified VGS-Collect card: a PLAN-AGNOSTIC, portable delegation whose settlement PSP (stripe / braintree) is resolved AT CHARGE TIME from the plan being paid (fiatPaymentProvider), so ONE card can charge ANY PSP (#2082). delegation.provider is persisted as the portable vgs marker (the concrete charge never sees it — the handler derives the real PSP at settle). Requires a portable providerPaymentMethodId (the CRD… cardId, which must carry an active network token); planId is OPTIONAL — pass it only to BIND the delegation to a single plan.

providerPaymentMethodIdstring

Payment-method identifier from the provider. For stripe / braintree this is the saved card; for visa this is the VGS agentic-token id returned by enrollment; for vgs this is the CRD… canonical cardId from the unified VGS-Collect enroll. Required for these providers; ignored for erc4337.

consumerPromptstring

Visa-only: human-readable approval prompt shown to the user during VGS Agentic Auth device binding. Required when provider=visa.

assuranceDataobject

Visa-only: opaque assurance payload from the VGS Agentic Auth browser SDK after FIDO/OTP device binding. Required when provider=visa.

spendingLimitCentsnumber required

Maximum spending limit in cents (smallest currency unit)

durationSecsnumber required

Duration of the delegation in seconds

currency'usd' | 'eur' | 'usdc' | 'eurc' required

Currency code (lowercase)

planIdstring

Plan ID to restrict this delegation to. Optional and plan-agnostic by default (#1534), INCLUDING provider=vgs (#2082): a unified VGS card delegation is plan-agnostic and the settlement PSP is resolved at charge time from the plan being paid, so one card can charge any PSP — pass planId only to BIND it to a single plan. EXCEPT provider=visa (the VGS mandate is merchant-scoped, derived from the plan owner; see BCK.VISA.0015), where it is REQUIRED.

maxTransactionsnumber

Maximum number of transactions allowed (null = unlimited)

apiKeyIdstring

Optional API Key ID (skId) to restrict this delegation to

allowedRecipientsstring[]

erc4337 / Router only: restrict spend to these pay-to addresses — the Router rejects payments to any other recipient. Omit for no recipient restriction.

organizationWalletIdstring

erc4337 / Router only (#2230): fund this delegation from an ORGANIZATION wallet instead of the caller's own wallet. The caller must be an admin of the wallet's org. Spend is always capped by the SPENDING member's group budget (the wallet must be shared with the member's group).

Example request

{
  "provider": "stripe",
  "providerPaymentMethodId": "pm_1Abc2Def3Ghi4Jkl",
  "consumerPrompt": "Allow up to USD 50.00 over 5 transactions",
  "spendingLimitCents": 10000,
  "durationSecs": 604800,
  "currency": "usd",
  "planId": "123456789",
  "maxTransactions": 50,
  "apiKeyId": "sk-abc123",
  "allowedRecipients": [
    "0x209693Bc6afc0C5328bA36FaF03C514EF312287C"
  ],
  "organizationWalletId": "orw-abc123"
}

Response

The created delegation

delegationIdstring required
delegationTokenstring nullable

Signed JWT for fiat-backed delegations (stripe/braintree). Omitted for crypto (erc4337) flows where the signed delegation is held client-side.

Example response

{
  "delegationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "delegationToken": "eyJhbGciOiJIUzI1NiIsInR..."
}

Changes

No recorded changes to this operation across all 1 revision of this API.