pub struct StripeWebhookConfig {
pub max_timestamp_age: Duration,
pub max_clock_drift: Duration,
pub idempotency_ttl: Duration,
pub idempotency_max_entries: usize,
pub processing_timeout: Duration,
pub max_retries: u32,
pub retry_base_delay: Duration,
pub log_payloads: bool,
/* private fields */
}Expand description
Configuration for Stripe webhook handling
Fields§
§max_timestamp_age: DurationMaximum age for webhook timestamps (replay attack protection) Stripe recommends 5 minutes (300 seconds)
max_clock_drift: DurationMaximum allowed clock drift (future timestamps)
idempotency_ttl: DurationIdempotency TTL - how long to remember processed events
idempotency_max_entries: usizeMaximum number of events to track for idempotency
processing_timeout: DurationAsync processing timeout
max_retries: u32Number of retry attempts for failed processing
retry_base_delay: DurationBase delay for exponential backoff (doubles each retry)
log_payloads: boolWhether to log event payloads (DISABLE in production for PII)
Implementations§
Source§impl StripeWebhookConfig
impl StripeWebhookConfig
Sourcepub fn from_env() -> StripeWebhookResult<Self>
pub fn from_env() -> StripeWebhookResult<Self>
Create configuration from environment variables
§Environment Variables
STRIPE_WEBHOOK_SECRET(required): Webhook signing secret (whsec_…)STRIPE_WEBHOOK_MAX_AGE(optional): Max timestamp age in seconds (default: 300)STRIPE_WEBHOOK_IDEMPOTENCY_TTL(optional): Idempotency TTL in seconds (default: 86400)STRIPE_WEBHOOK_PROCESSING_TIMEOUT(optional): Processing timeout in seconds (default: 30)STRIPE_WEBHOOK_MAX_RETRIES(optional): Max retry attempts (default: 3)STRIPE_WEBHOOK_LOG_PAYLOADS(optional): Log payloads - DISABLE IN PROD (default: false)
§Errors
Returns StripeWebhookError::MissingSecret if STRIPE_WEBHOOK_SECRET is not set.
Sourcepub fn retry_delay(&self, attempt: u32) -> Duration
pub fn retry_delay(&self, attempt: u32) -> Duration
Calculate retry delay with exponential backoff and jitter
Trait Implementations§
Source§impl Clone for StripeWebhookConfig
impl Clone for StripeWebhookConfig
Source§fn clone(&self) -> StripeWebhookConfig
fn clone(&self) -> StripeWebhookConfig
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 StripeWebhookConfig
impl RefUnwindSafe for StripeWebhookConfig
impl Send for StripeWebhookConfig
impl Sync for StripeWebhookConfig
impl Unpin for StripeWebhookConfig
impl UnwindSafe for StripeWebhookConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more