Warm tip: This article is reproduced from stackoverflow.com, please click
ruby-on-rails stripe-payments

Stripe Exception double rendering using stripe gem

发布于 2020-04-03 23:47:52

I am using Stripe gem in my rails application, it's working fine in the development environment but in my production environment getting an exception. Stripe::APIError: (Status 409) with message There is currently another in-progress request using this Idempotent Key (that probably means you submitted twice, and the other request is still going through).

How can I rescue this or handle this exception?

Any help would be appreciated.

Questioner
SaurabhRoR
Viewed
71
code_aks 2020-01-31 21:16

The retry logic is supposed to be for when your application doesn't know Stripe's response, primarily during network issues likes timeouts. In this case your server received a response from stripe and one of two things could be happening. Either you're retring the same event that is currently in progress /or/ the event in progress is actually different than the one you're trying but given some issue in your application stack you actually chose the same indempotency token for two api requests.

For further details please read this link :- https://stripe.com/docs/api/idempotent_requests