pub struct X402LayerBuilder<TSource, TFacilitator> { /* private fields */ }server only.Expand description
Builder for configuring the X402 middleware layer.
Generic over TSource which implements PriceTagSource to support
both static and dynamic pricing strategies.
Implementations§
Source§impl<TFacilitator> X402LayerBuilder<StaticPriceTags, TFacilitator>
impl<TFacilitator> X402LayerBuilder<StaticPriceTags, TFacilitator>
Sourcepub fn with_price_tag(self, price_tag: PriceTag) -> Self
pub fn with_price_tag(self, price_tag: PriceTag) -> Self
Adds another payment option.
Allows specifying multiple accepted payment methods (e.g., different networks).
Note: This method is only available for static price tag sources.
Source§impl<TSource, TFacilitator> X402LayerBuilder<TSource, TFacilitator>
impl<TSource, TFacilitator> X402LayerBuilder<TSource, TFacilitator>
Sourcepub fn with_description(self, description: String) -> Self
pub fn with_description(self, description: String) -> Self
Sets a description of what the payment grants access to.
This is included in 402 responses to inform clients what they’re paying for.
Sourcepub fn with_mime_type(self, mime: String) -> Self
pub fn with_mime_type(self, mime: String) -> Self
Sets the MIME type of the protected resource.
Defaults to application/json if not specified.
Sourcepub fn with_resource(self, resource: Url) -> Self
pub fn with_resource(self, resource: Url) -> Self
Sets the full URL of the protected resource.
When set, this URL is used directly instead of constructing it from the base URL and request URI. This is the preferred approach in production.
Sourcepub const fn with_settlement_mode(self, mode: SettlementMode) -> Self
pub const fn with_settlement_mode(self, mode: SettlementMode) -> Self
Sets the settlement mode.
SettlementMode::Sequential(default): verify → execute → settle.SettlementMode::Concurrent: verify → (settle ∥ execute) → await settle.
Concurrent mode reduces total latency by overlapping settlement with handler execution at the cost of initiating settlement before knowing whether the handler will succeed.
Trait Implementations§
Source§impl<TSource: Clone, TFacilitator: Clone> Clone for X402LayerBuilder<TSource, TFacilitator>
impl<TSource: Clone, TFacilitator: Clone> Clone for X402LayerBuilder<TSource, TFacilitator>
Source§fn clone(&self) -> X402LayerBuilder<TSource, TFacilitator>
fn clone(&self) -> X402LayerBuilder<TSource, TFacilitator>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more