/** * X402 Token Generation API. * * Provides X402 access token generation functionality for subscribers. * Tokens are used to authorize payment verification and settlement. */ import { BasePaymentsAPI } from '../api/base-payments.js'; import { PaymentOptions, X402TokenOptions } from '../common/types.js'; /** * X402 Token API for generating access tokens. * * Handles X402 access token generation for subscribers to authorize * payment operations with AI agents. */ export declare class X402TokenAPI extends BasePaymentsAPI { /** * Get a singleton instance of the X402TokenAPI class. * * @param options - The options to initialize the API * @returns The instance of the X402TokenAPI class */ static getInstance(options: PaymentOptions): X402TokenAPI; /** * Get an X402 access token for the given plan, backed by a delegation. * * This token allows the agent to verify and settle delegations on behalf * of the subscriber. * * The supported flow is **create-first**: create the delegation once with * {@link DelegationAPI.createDelegation}, then pass its `delegationId` in * `tokenOptions.delegationConfig`. Passing inline create-on-the-fly fields * (spending limits / `providerPaymentMethodId` / `cardId`, i.e. no * `delegationId`) is **deprecated** and emits a runtime warning. * * @param planId - The unique identifier of the payment plan * @param agentId - The unique identifier of the AI agent (optional) * @param tokenOptions - Options controlling scheme and delegation behavior (optional) * @returns A promise that resolves to an object containing: * - accessToken: The X402 access token string * * @throws PaymentsError if the request fails * * @example * ```typescript * // Supported: create the delegation first, then request the token by id. * const { delegationId } = await payments.delegation.createDelegation({ * provider: 'erc4337', * spendingLimitCents: 10000, * durationSecs: 604800, * currency: 'usdc', * }) * const result = await payments.x402.getX402AccessToken(planId, agentId, { * delegationConfig: { delegationId }, * }) * ``` */ getX402AccessToken(planId: string, agentId?: string, tokenOptions?: X402TokenOptions): Promise<{ accessToken: string; [key: string]: any; }>; } //# sourceMappingURL=token.d.ts.map