Skip to main content
Defined in: server.ts:1139 Creates and initializes a CDP-powered x402 resource server. Returns an X402Server which extends x402HTTPResourceServer and can be passed directly to paymentMiddlewareFromHTTPServer or any other framework adapter. All credential fields fall back to environment variables; an empty {} with a routes map is sufficient in most environments. Pass payToConfig: { type: "address", evm: "0x...", solana: "..." } to provide your own receiver addresses without provisioning a CDP wallet.

Parameters

config

CdpX402ServerConfig Credential, wallet, and route configuration. All credential fields fall back to environment variables; routes is the only required field (or configPath pointing to a JSON file that supplies routes).

Returns

Promise<X402Server> A fully initialized X402Server ready to be passed to any framework middleware.

Examples