woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
229 stars 197 forks source link

Add a rate limit to the configure webhook request #3212

Open james-allan opened 2 weeks ago

james-allan commented 2 weeks ago

Part of #3195 Fixes #3213

Changes proposed in this Pull Request:

This PR adds a rate limit to the (Re)Configure webhooks button in the admin settings to prevent sending multiple Stripe requests if the merchant keeps clicking the button.

Screenshot 2024-06-19 at 1 46 51 PM
If you click the Configure webhooks button within a minute of the last request, you will see this response.

Testing instructions

  1. Checkout this branch and run npm run build
  2. Go to your Stripe API settings and click the Configure webhooks or reconfigure webhooks button.
  3. You should see a success notice.
  4. Click the button again and you should see the error message regarding the rate limit.
  5. Wait 1 minute and click the button again, the request should be successful now.

Post merge