AixyzServer extends x402ResourceServer from @x402/core/server, which wraps Express 5. It provides built-in x402 payment verification for agent and tool endpoints.
Constructor
| Parameter | Type | Default | Description |
|---|---|---|---|
facilitator | FacilitatorClient | Default x402 facilitator | Payment verification service |
config | AixyzConfig | Loaded from aixyz.config.ts | Agent configuration |
express | Express | New Express 5 app | Express instance to use |
await server.initialize() before registering any routes.
Properties
| Property | Type | Description |
|---|---|---|
config | AixyzConfig | The parsed agent configuration |
express | Express | The underlying Express 5 app |
Methods
withX402Exact(route, accepts)
Registers x402 payment middleware on a route:
| Parameter | Type | Description |
|---|---|---|
route | `${"GET" | "POST"} /${string}` | Route pattern |
accepts | AcceptsX402 | Payment configuration |
payTo and network fields default to the values from your aixyz.config.ts if not specified in the accepts object.