pub struct PaymentMiddlewareConfig {
pub amount: Decimal,
pub pay_to: String,
pub description: Option<String>,
pub mime_type: Option<String>,
pub max_timeout_seconds: u32,
pub output_schema: Option<Value>,
pub facilitator_config: FacilitatorConfig,
pub testnet: bool,
pub custom_paywall_html: Option<String>,
pub resource: Option<String>,
pub resource_root_url: Option<String>,
}Expand description
Configuration for payment middleware
Fields§
§amount: DecimalPayment amount in decimal units (e.g., 0.0001 for 1/10th of a cent)
pay_to: StringRecipient wallet address
description: Option<String>Payment description
mime_type: Option<String>MIME type of the expected response
max_timeout_seconds: u32Maximum timeout in seconds
output_schema: Option<Value>JSON schema for response format
facilitator_config: FacilitatorConfigFacilitator configuration
testnet: boolWhether this is a testnet
custom_paywall_html: Option<String>Custom paywall HTML for web browsers
resource: Option<String>Resource URL (if different from request URL)
resource_root_url: Option<String>Resource root URL for constructing full resource URLs
Implementations§
Source§impl PaymentMiddlewareConfig
impl PaymentMiddlewareConfig
Sourcepub fn new(amount: Decimal, pay_to: impl Into<String>) -> Self
pub fn new(amount: Decimal, pay_to: impl Into<String>) -> Self
Create a new payment middleware config
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the payment description
Sourcepub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
pub fn with_mime_type(self, mime_type: impl Into<String>) -> Self
Set the MIME type
Sourcepub fn with_max_timeout_seconds(self, max_timeout_seconds: u32) -> Self
pub fn with_max_timeout_seconds(self, max_timeout_seconds: u32) -> Self
Set the maximum timeout
Sourcepub fn with_output_schema(self, output_schema: Value) -> Self
pub fn with_output_schema(self, output_schema: Value) -> Self
Set the output schema
Sourcepub fn with_facilitator_config(
self,
facilitator_config: FacilitatorConfig,
) -> Self
pub fn with_facilitator_config( self, facilitator_config: FacilitatorConfig, ) -> Self
Set the facilitator configuration
Sourcepub fn with_testnet(self, testnet: bool) -> Self
pub fn with_testnet(self, testnet: bool) -> Self
Set whether this is a testnet
Sourcepub fn with_custom_paywall_html(self, html: impl Into<String>) -> Self
pub fn with_custom_paywall_html(self, html: impl Into<String>) -> Self
Set custom paywall HTML
Sourcepub fn with_resource(self, resource: impl Into<String>) -> Self
pub fn with_resource(self, resource: impl Into<String>) -> Self
Set the resource URL
Sourcepub fn with_resource_root_url(self, url: impl Into<String>) -> Self
pub fn with_resource_root_url(self, url: impl Into<String>) -> Self
Set the resource root URL
Sourcepub fn create_payment_requirements(
&self,
request_uri: &str,
) -> Result<PaymentRequirements>
pub fn create_payment_requirements( &self, request_uri: &str, ) -> Result<PaymentRequirements>
Create payment requirements from this config
Trait Implementations§
Source§impl Clone for PaymentMiddlewareConfig
impl Clone for PaymentMiddlewareConfig
Source§fn clone(&self) -> PaymentMiddlewareConfig
fn clone(&self) -> PaymentMiddlewareConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PaymentMiddlewareConfig
impl !RefUnwindSafe for PaymentMiddlewareConfig
impl Send for PaymentMiddlewareConfig
impl Sync for PaymentMiddlewareConfig
impl Unpin for PaymentMiddlewareConfig
impl !UnwindSafe for PaymentMiddlewareConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more