Skip to content
ndStill is in development. These docs describe the v2 API as designed; the SDKs and the hosted MCP server are previews and not generally available.
Docs

Agent tokens and checkout tokens

Stripe Shared Payment Tokens, Visa and Mastercard agent tokens, and AP2: scoped tokens instead of card numbers.

A token is a card or account credential that only works for one purpose: one merchant, up to one amount, until one time. Where a merchant or checkout accepts tokens, they are the safest way for an agent to pay. There is no card number to leak, and the limits travel with the credential instead of living only in ndStill's policy. This guide covers the two token families ndStill issues for agents: checkout tokens (Stripe Shared Payment Tokens, and the AP2 family) and network agent tokens (Visa Intelligent Commerce, Mastercard Agent Pay).

Why tokens instead of cards#

A single-use virtual card already narrows what an agent can do, but it is still a card number. Something has to type it into a form, and a merchant's systems store it. A token changes both:

  • The scope is cryptographic. The token is bound to the merchant, the amount and the expiry by the network or the token service. A merchant that isn't in scope can't charge it.
  • Nothing sensitive reaches the agent. The agent passes an opaque token reference, never a primary account number.
  • Revocation is clean. Freezing the agent revokes its tokens at the token service, so a token that leaked after the fact is dead.

The trade-off is reach: only merchants and checkouts that accept tokens can take them. The router in pay() picks a token when the counterparty accepts one and the owner allows it, and falls back to a single-use card when it doesn't. See Cards and issuing.

The two families#

Token families
TokenIssued byBound toTypical merchant
Stripe Shared Payment Token (SPT)Stripe, on the owner's Stripe account, with usage_limitsOne seller's Stripe account, a maximum amount, an expiryMerchants on Stripe checkout and the Agentic Commerce Protocol
AP2 / UCP payment credentialThe owner's payment provider, through Google's agent payments protocolA signed mandate: merchant, amount band, expiryMerchants that accept AP2
Visa agent tokenVisa Intelligent Commerce, requested by the card issuerThe agent, a merchant, an amount and an expiryMerchants that accept Visa network tokens
Mastercard agent tokenMastercard Agent Pay, requested by the card issuerThe agent, a merchant, an amount and an expiryMerchants that accept Mastercard network tokens

All of them land in the API as a credential with type set to spt or network_token, a scope and a minted_by_decision_id:

JSON
{
  "id": "cred_01JD9Q2K7V",
  "object": "credential",
  "agent": { "id": "agt_01JD8X4N2Q", "name": "Travel desk" },
  "type": "network_token",
  "rail": "network_token",
  "funding_source": { "id": "fs_01JD8W1A3C", "name": "Ops card program" },
  "scope": {
    "counterparty": "Delta Air Lines",
    "amount": { "amount": 54000, "asset": "USD" },
    "expires_at": "2026-11-06T18:00:00Z",
    "uses": 1
  },
  "status": "active",
  "display": "Visa token ····8812",
  "minted_by_decision_id": "dec_01JD9Q2K5T",
  "revoked_at": null
}

How a token is minted#

Minting a token is the last step of an approved decision, never the first. The agent asks to pay; the pipeline decides; only then does ndStill request a token scoped to exactly what was approved.

  1. The agent calls pay()

    TypeScript
    const payment = await ndstill.pay({
      agent: "agt_01JD8X4N2Q",
      amount: { amount: 54000, asset: "USD" }, // $540.00 in cents
      counterparty: "Delta Air Lines",
      purpose: "Flight SFO to JFK, Friday, under $600",
    });
  2. The pipeline decides

    Identity, freeze, funding, the mandate match ("airlines only, up to $600, by Friday"), policy, risk, budget and the approval line all run. A hold stops here and waits for a person; a decline returns reasons.

  3. ndStill requests the token

    For a network token, ndStill asks the card issuer's token service for a token bound to the merchant, the approved amount and an expiry (an hour by default). For an SPT, it creates a Shared Payment Token on the owner's connected Stripe account with usage_limits equal to the approval.

  4. The agent pays with it

    The payment comes back approved with a credential_id. The agent fetches the credential (the MCP tool get_credential, or the SDK) and presents the token at checkout. The merchant charges it; the authorization comes back to ndStill and is matched to the reservation.

  • Passed
  • Held here
  • Declined here
  • Not on this rail
  • Not reached
A $540 flight held at the approval line ($300 for this agent). After a person approves with a passkey, the pipeline runs again and the token is minted.

Matching the charge to the decision#

When a token is charged, the authorization reaches ndStill the same way a card authorization does, and it is matched against the credential's scope and the open reservation. A charge from the wrong merchant, above the scoped amount (plus the policy's tolerance), after expiry, or after the agent was frozen is declined. The token service enforces the same scope on its side, so the check happens twice.

For checkout tokens on a connected Stripe account, ndStill learns the outcome from the owner's Stripe webhooks and records it in the payment timeline. SPT revocation happens on the owner's Stripe account, through the connection.

Control levels for tokens#

Tokens sit between Authorize and Issue, depending on who issues them:

Control level by token situation
SituationLevelWhat it means
Network token on an ndStill-issued cardAuthorizendStill decides whether to request the token, and decides every authorization against it.
Network token on your own card programAuthorizeYour issuer requests the token; ndStill decides whether to ask, and decides the authorization through your program's webhook.
SPT on your Stripe accountIssuendStill mints the token with usage limits; Stripe enforces them. ndStill revokes on freeze.

Each connection in Connections shows its control level and its measured stop time, so you can see how quickly a freeze actually revokes tokens on each provider.

Revoking tokens#

Tokens are revoked in three ways:

  • One credential: POST/credentials/{id}/revoke with a reason.
  • Many at once: POST/credentials/bulk-revoke, for example every active token for a merchant you stopped trusting.
  • Everything an agent holds: freezing the agent revokes every token at every provider as part of the kill switch fan-out, and records when each provider confirmed.

A revoked credential stays in the record with revoked_at and revoked_by, and a credential.revoked event goes to your webhooks.

Testing token flows#

Test keys (nds_test_…) run the same pipeline and return the same decision and trace, but mint nothing and call no network. Simulate before you ship:

TypeScript
const sim = await ndstill.simulate({
  agent: "agt_01JD8X4N2Q",
  amount: { amount: 54000, asset: "USD" },
  counterparty: "Delta Air Lines",
  rail: "network_token",
});
console.log(sim.would_outcome, sim.trace.map((s) => `${s.stage}: ${s.result}`));