SellerConfig
The central configuration object for Key0. Pass it to any framework integration to stand up payment-gated endpoints:- Express —
key0Router(config) - Hono —
key0App(config) - Fastify —
key0Plugin(config) - Factory —
createKey0(config)
Identity
Fields that populate the A2A agent discovery card.| Field | Type | Required | Default | Description |
|---|---|---|---|---|
agentName | string | Yes | — | Display name shown in the agent card. |
agentDescription | string | Yes | — | Short description of the agent’s capabilities. |
agentUrl | string | Yes | — | Public base URL of your server (used for endpoint discovery). |
providerName | string | Yes | — | Organization or developer name. |
providerUrl | string | Yes | — | Organization URL. |
version | string | No | "1.0.0" | Semantic version exposed in the agent card. |
Payment
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
walletAddress | `0x${string}` | Yes | — | Address that receives USDC payments. |
network | "testnet" | "mainnet" | Yes | — | "testnet" targets Base Sepolia (chain 84532). "mainnet" targets Base (chain 8453). |
Product Catalog
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
plans | readonly Plan[] | Yes | — | One or more pricing plans. See Plan below. |
Challenge
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
challengeTTLSeconds | number | No | 900 | How long (in seconds) a challenge remains valid before expiring. |
Credential Issuance
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
fetchResourceCredentials | (params: IssueTokenParams) => Promise<TokenIssuanceResult> | Yes | — | Called after on-chain payment is verified. Return a token (JWT, API key, etc.) that grants the buyer access to the resource. See IssueTokenParams and TokenIssuanceResult. |
tokenIssueTimeoutMs | number | No | 15000 | Maximum time (ms) to wait for fetchResourceCredentials before timing out. |
tokenIssueRetries | number | No | 2 | Number of retries on transient failures within fetchResourceCredentials. |
Lifecycle Hooks
Optional callbacks fired during the challenge lifecycle. Both are fire-and-forget — failures are logged but do not affect the payment flow.| Field | Type | Required | Default | Description |
|---|---|---|---|---|
onPaymentReceived | (grant: AccessGrant) => Promise<void> | No | — | Fired after a payment is verified and credentials are issued. |
onChallengeExpired | (challengeId: string) => Promise<void> | No | — | Fired when a challenge passes its TTL without payment. |
MCP
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
mcp | boolean | No | false | When true, mounts MCP discovery (/.well-known/mcp.json) and Streamable HTTP (POST /mcp) endpoints alongside A2A routes. |
Customization
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
basePath | string | No | "/a2a" | Prefix for all A2A endpoints. |
resourceEndpointTemplate | string | No | auto-generated | URL template containing {resourceId} that appears in the access grant. Example: "https://api.example.com/photos/{resourceId}". |
Settlement
Control how on-chain settlement is performed. By default, settlement is routed through the Coinbase Developer Platform facilitator.| Field | Type | Required | Default | Description |
|---|---|---|---|---|
gasWalletPrivateKey | `0x${string}` | No | — | Provide a private key to enable self-contained gas wallet settlement instead of the facilitator. |
facilitatorUrl | string | No | CDP default | Override the default facilitator URL from CHAIN_CONFIGS. |
redis | IRedisLockClient | No | — | Redis client for distributed locking when using gas wallet settlement across multiple instances. Without this, an in-process serial queue is used (single-instance only). |
Supporting Types
Plan
Defines a pricing tier that buyers can select.| Field | Type | Required | Description |
|---|---|---|---|
planId | string | Yes | Unique identifier for this plan. |
unitAmount | string | Yes | Dollar-formatted price string (e.g. "$0.10", "$5.00"). |
description | string | No | Human-readable label for the plan. |
IssueTokenParams
Passed tofetchResourceCredentials after payment verification.
| Field | Type | Description |
|---|---|---|
requestId | string | Original access request ID. |
challengeId | string | Challenge that was fulfilled. |
resourceId | string | Resource the buyer is purchasing access to. |
planId | string | Selected plan from the catalog. |
txHash | string | On-chain transaction hash of the USDC transfer. |
TokenIssuanceResult
Returned fromfetchResourceCredentials.
| Field | Type | Required | Description |
|---|---|---|---|
token | string | Yes | The credential (JWT, API key, etc.) the buyer will use to access the resource. |
tokenType | string | No | Token scheme. Defaults to "Bearer". |

