diff --git a/CHANGELOG.md b/CHANGELOG.md index c374188bf..8eb30a0fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,8 @@ end * `paddle_pay ~> 0.2` * `receipts ~> 2` +* Stripe.max_network_retries is now set to 2 by default. - @excid3 + This adds idempotency keys automatically to each request so that they can be safely retried. * Stripe Subscriptons can now be paused and resumed - @excid3 * Replace `update_email!` with `update_customer!` - @excid3 * Add options for `cancel_now!` to support `invoice_now` and `prorate` flags for Stripe - @excid3 diff --git a/lib/pay/stripe.rb b/lib/pay/stripe.rb index 1e8941a79..8eea6d016 100644 --- a/lib/pay/stripe.rb +++ b/lib/pay/stripe.rb @@ -40,6 +40,11 @@ def self.setup # Used by Stripe to identify Pay for support ::Stripe.set_app_info("PayRails", partner_id: "pp_partner_IqhY0UExnJYLxg", version: Pay::VERSION, url: "https://github.com/pay-rails/pay") + + # Automatically retry requests that fail + # This automatically includes idempotency keys in the request to guarantee that retires are safe + # https://github.com/stripe/stripe-ruby#configuring-automatic-retries + ::Stripe.max_network_retries = 2 end def self.public_key