x402HTTPResourceServer.
It is a drop-in replacement anywhere an x402HTTPResourceServer is
expected — pass it directly to paymentMiddlewareFromHTTPServer, Hono /
Next.js adapters, or any other framework integration.
Use createX402Server() (or X402Server.create()) to obtain an initialized
instance. The constructor is intentionally private; call the factory instead.
In addition to the full x402HTTPResourceServer surface (initialize(),
processHTTPRequest(), processSettlement(), requiresPayment(), etc.)
this class exposes payToEvmAddress and payToSvmAddress for the
provisioned receiver wallets.
Extends
x402HTTPResourceServer
Properties
payToEvmAddress
undefined when no EVM wallet was
provisioned (no eip155:* route, and payToConfig did not supply an
evm address).
payToSvmAddress
undefined when no
Solana wallet was provisioned (no solana:* route, and payToConfig did
not supply a solana address).
ownerWallet
"smart" receiver wallets, otherwise undefined.
Only set when payToConfig.type is "smart".
Accessors
resourceServer
Get Signature
x402ResourceServer with EVM and Solana schemes registered.
Returns
x402ResourceServer
The x402ResourceServer instance used by this server.
Methods
create()
payToConfig.type is "address"),
resolves routes, constructs the HTTP resource server, and syncs supported
schemes with the CDP facilitator.
This is the async entry point for X402Server. Prefer the module-level
createX402Server() wrapper for convenience.
Parameters
config
CdpX402ServerConfig
Credential, wallet, and route configuration.
Returns
Promise<X402Server>
A fully initialized X402Server instance ready to be passed to
any framework middleware.
initialize()
createX402Server() already calls this before returning, and framework
adapters such as paymentMiddlewareFromHTTPServer call initialize()
again on startup. The base implementation re-fetches facilitator support
on every call, so this override memoizes the first run to avoid a redundant
facilitator round-trip. The promise is cleared on failure so a later call
can retry.
Returns
Promise<void>
A promise that resolves once initialization has completed.