Skip to main content
Types and utilities for configuring x402 payment gating on agent and tool endpoints.

Types

Accepts

Union type for payment configuration. Supports a single payment option, free access, or an array of payment options for multi-network support:

AcceptsX402

Requires x402 exact payment:
FieldTypeRequiredDescription
schemestringYesMust be "exact"
pricestringYesUSD price string (e.g. "$0.005")
networkstringNoCAIP-2 chain ID, overrides x402.network from config
payTostringNoEVM address to receive payment, overrides x402.payTo config

AcceptsX402Entry

A single payment option within a multi-accepts array. Same as AcceptsX402 but network is required — the server needs an explicit network to register each payment scheme:
FieldTypeRequiredDescription
schemestringYesMust be "exact"
pricestringYesUSD price string (e.g. "$0.005")
networkstringYesCAIP-2 chain ID — required for multi-accepts
payTostringNoEVM address to receive payment, overrides x402.payTo config

AcceptsX402Multi

An array of payment entries, enabling multi-network support. Must contain at least one entry:

AcceptsFree

No payment required:

Exports

normalizeAcceptsX402

Converts a single or multi accepts value into a uniform array:

isAcceptsPaid

Type guard that returns true if the accepts config requires payment (i.e., is not { scheme: "free" }):

HTTPFacilitatorClient

Client for communicating with an x402 facilitator service. Re-exported from @x402/core/server.

facilitator

The default facilitator client used by AixyzApp. Points to the Agently-hosted x402 facilitator.

AcceptsScheme

Zod schema for validating Accepts objects at runtime. Accepts a single object or an array of payment entries:

Usage

Agents and tools declare an accepts export to control x402 payment gating. Endpoints without accepts are not registered.
app/agent.ts
app/tools/lookup.ts

Multiple payment options

Accept payment across multiple networks by passing an array. Each entry requires an explicit network:
app/agent.ts
All referenced networks are automatically registered with the payment gateway during initialization — no manual setup required.

Custom facilitator

Create app/accepts.ts to override the default facilitator:
app/accepts.ts