Skip to main content

Module layer

Module layer 

Source
Available on crate feature server only.
Expand description

Axum middleware for enforcing x402 payments on protected routes.

This middleware validates incoming payment headers using a configured x402 facilitator, verifies the payment, executes the request, and settles valid payments after successful execution. If the handler returns an error (4xx/5xx), settlement is skipped.

Returns a 402 Payment Required response if the request lacks a valid payment.

§Configuration Notes

Structs§

X402LayerBuilder
Builder for configuring the X402 middleware layer.
X402Middleware
The main X402 middleware instance for enforcing x402 payments on routes.
X402MiddlewareService
Axum service that enforces x402 payments on incoming requests.