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§
- Background
Settlement Tracker - Shared in-flight counter for background settlement tasks.
- Dynamic
Price Tags - Per-request price tags from an async callback.
- Facilitator
Client - A client for communicating with a remote x402 facilitator.
- Gate
- HTTP payment gate.
- InMemory
Paid Address Store siwx - Process-local
PaidAddressStore. - Resource
Server - Server-side payment orchestrator.
- Settlement
Overrides - Official wire shape for partial settlement.
- Siwx
Chain siwx - One entry in
supportedChains. - Siwx
Client Extension siwx - Client extension that signs HTTP SIWX challenges for compatible wallets.
- Siwx
Gate - Resource-server SIWX configuration used by the HTTP gate.
- Siwx
Origin siwx - Absolute public origin used as the SIWX trust anchor.
- Siwx
Proof siwx - Client proof carried on
SIGN-IN-WITH-X(base64 JSON). - Skip
Handler Directive - In-process directive when an after-verify hook skips the resource handler.
- Static
Price Tags - Fixed tag list for every request.
- Upto
Actual Amount - In-process atomic-amount override (already resolved units).
- X402
Layer - Tower layer produced by
super::X402Middleware::with_price_tag. - X402
Middleware - Application-level x402 middleware. Owns a
ResourceServer. - X402
Middleware Service - Service produced by
X402Layer.
Enums§
- Build
Error - Construction failure for static HTTP layers.
- Facilitator
Client Error - Errors that can occur while constructing a client or resolving auth headers.
- Gate
Error - HTTP payment-gate failure.
- Protected
Request Outcome - Outcome of
GateHooks::on_protected_request. - Settlement
Mode - After-handler settle scheduler for
PaymentFlowName::Authorization. - Settlement
Override Error - Failure resolving a settlement override amount string.
- Siwx
Error siwx - Spec
invalid_siwx_*failure codes. - Siwx
Origin Error siwx - Failed to parse a configured public origin.
- Siwx
Proof Error siwx - Failed to decode a
SIGN-IN-WITH-Xheader.
Constants§
- SETTLEMENT_
OVERRIDES_ HEADER - Official HTTP header for partial settlement.
- SIWX_
HTTP_ HEADER siwx - HTTP request header carrying a SIWX proof. Never emit as a response header.
- SIWX_
KEY siwx - Wire key for the Sign-In with X extension.
Traits§
- DynGate
Hooks - Object-safe erasure of
GateHooks. - Facilitator
- Unified asynchronous interface for x402 facilitators.
- Gate
Hooks - HTTP-layer hooks. Defaults are no-ops.
- Paid
Address Store siwx - Addresses that completed a successful settlement, plus consumed nonces.
- Price
TagSource - Resolves V2 price tags for one request.
- Scheme
Network Server - Scheme/network adapter registered on
crate::ResourceServer. - Siwx
Signer siwx - 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
ErrorReasonto 412 (Permit2) or 402. - resolve_
response_ settlement_ amount - Resolves handler-declared actual amount (atomic units).
- set_
settlement_ overrides - Writes
Settlement-OverridesJSON ontoheaders. - 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/UptoActualAmountso billing signals never reach the client. - take_
settlement_ overrides_ header - Parses and removes
Settlement-Overridesso it never reaches the client.