Skip to main content

Module server

Module server 

Source
Available on crate feature server only.
Expand description

Axum/Tower payment gate. SettlementMode schedules authorization’s after-handler settle.

Re-exports§

pub use crate::headers::PAYMENT_REQUIRED;
pub use crate::headers::PAYMENT_RESPONSE;
pub use crate::headers::PAYMENT_SIGNATURE;
pub use crate::headers::SIGN_IN_WITH_X;
pub use crate::headers::X402_EXPOSED_HEADERS;
pub use crate::headers::ensure_expose_headers;
pub use crate::headers::merge_private;
pub use crate::headers::set_no_store;

Structs§

BackgroundSettlementTracker
Shared in-flight counter for background settlement tasks.
DynamicPriceTags
Per-request price tags from an async callback.
FacilitatorClient
A client for communicating with a remote x402 facilitator.
Gate
HTTP payment gate.
InMemoryPaidAddressStoresiwx
Process-local PaidAddressStore.
ResourceServer
Server-side payment orchestrator.
SettlementOverrides
Official wire shape for partial settlement.
SiwxChainsiwx
One entry in supportedChains.
SiwxClientExtensionsiwx
Client extension that signs HTTP SIWX challenges for compatible wallets.
SiwxGate
Resource-server SIWX configuration used by the HTTP gate.
SiwxOriginsiwx
Absolute public origin used as the SIWX trust anchor.
SiwxProofsiwx
Client proof carried on SIGN-IN-WITH-X (base64 JSON).
SkipHandlerDirective
In-process directive when an after-verify hook skips the resource handler.
StaticPriceTags
Fixed tag list for every request.
UptoActualAmount
In-process atomic-amount override (already resolved units).
X402Layer
Tower layer produced by super::X402Middleware::with_price_tag.
X402Middleware
Application-level x402 middleware. Owns a ResourceServer.
X402MiddlewareService
Service produced by X402Layer.

Enums§

BuildError
Construction failure for static HTTP layers.
FacilitatorClientError
Errors that can occur while constructing a client or resolving auth headers.
GateError
HTTP payment-gate failure.
ProtectedRequestOutcome
Outcome of GateHooks::on_protected_request.
SettlementMode
After-handler settle scheduler for PaymentFlowName::Authorization.
SettlementOverrideError
Failure resolving a settlement override amount string.
SiwxErrorsiwx
Spec invalid_siwx_* failure codes.
SiwxOriginErrorsiwx
Failed to parse a configured public origin.
SiwxProofErrorsiwx
Failed to decode a SIGN-IN-WITH-X header.

Constants§

SETTLEMENT_OVERRIDES_HEADER
Official HTTP header for partial settlement.
SIWX_HTTP_HEADERsiwx
HTTP request header carrying a SIWX proof. Never emit as a response header.
SIWX_KEYsiwx
Wire key for the Sign-In with X extension.

Traits§

DynGateHooks
Object-safe erasure of GateHooks.
Facilitator
Unified asynchronous interface for x402 facilitators.
GateHooks
HTTP-layer hooks. Defaults are no-ops.
PaidAddressStoresiwx
Addresses that completed a successful settlement, plus consumed nonces.
PriceTagSource
Resolves V2 price tags for one request.
SchemeNetworkServer
Scheme/network adapter registered on crate::ResourceServer.
SiwxSignersiwx
Wallet that can produce a CAIP-122 SIWX proof.

Functions§

marshal_settlement_overrides
Serializes overrides the same way foundation HTTP adapters do.
reason_to_status
Maps an ErrorReason to 412 (Permit2) or 402.
resolve_response_settlement_amount
Resolves handler-declared actual amount (atomic units).
set_settlement_overrides
Writes Settlement-Overrides JSON onto headers.
set_settlement_overrides_on_response
Convenience when the handler holds a full response.
settlement_overrides_header_name
Lowercase wire name.
settlement_to_header
Encodes a successful settlement as Payment-Response.
strip_response_settlement_overrides
Drops Settlement-Overrides / UptoActualAmount so billing signals never reach the client.
take_settlement_overrides_header
Parses and removes Settlement-Overrides so it never reaches the client.