Skip to content
Docs
Get RestroPress

Filter

rpress_core_stripe_webhook_tolerance

Updated
On this page

Filters the allowed clock difference, in seconds, when verifying a Stripe webhook signature.

Runs in rpress_core_stripe_verify_webhook_signature. The webhook is rejected when the timestamp in the Stripe-Signature header differs from the current time by more than this value. The result is cast to an integer, and a value of 0 or less skips the timestamp check.

Parameters#

ParameterTypeDescription
$toleranceintTolerance in seconds. The default is 300.

Return value#

int. The tolerance in seconds.

Example#

function my_stripe_webhook_tolerance( $tolerance ) {
	return 600;
}
add_filter( 'rpress_core_stripe_webhook_tolerance', 'my_stripe_webhook_tolerance' );

Notes#

The signature itself is still verified when the tolerance is 0 or less; only the timestamp comparison is skipped.

Source#

Applied in:

  • includes/features/payments/stripe-webhooks.php (line 175), in rpress_payments_stripe_handle_webhook()
  • includes/gateways/stripe.php (line 699), in rpress_core_stripe_verify_webhook_signature()

See also#

Was this page helpful?