gform_stripe_enable_rate_limits

Description

Error rate limiting is enabled by default, blocking for one hour any IP address that reaches five errors. If you encounter a log entry such as GFStripe::maybe_hit_rate_limits(), it indicates that the rate limiting has been triggered. This filter provides the ability to disable error rate limiting temporarily for use while testing your form.

Do not use this filter to disable error rate limiting in a production environment with the Stripe Add-On set to “Live” mode on the Forms → Settings → Stripe page, except temporarily for testing purposes. This filter should only be used while testing your forms.

Error rate limiting is implemented to prevent your forms that use the Stripe Add-On from being used for card testing (“carding“). If you disable error rate limiting in a production environment, you leave yourself open to processing transactions for stolen credit cards, which may lead to more credit card disputes.

Usage

add_filter( 'gform_stripe_enable_rate_limits', 'your_function_name', 10, 2 );

Parameters

  • $has_error bool
    Indicates whether error rate limiting is enabled. Defaults to true (error rate limiting enabled).
  • $form_id int
    The ID of the form being submitted.

Example

The following would disable error rate limiting for all forms:

add_filter( 'gform_stripe_enable_rate_limits', '__return_false' );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This filter was added in Stripe 3.4.

Source Code

This filter is located in class-gf-stripe.php.