#EmpowerJohn-idempotency
1 messages · Page 1 of 1 (latest)
Hello! Starting up a thread for you
Your interpretation of "If the above Stripe request fails due to a network connection error, you can safely retry it with the same idempotency key, and the customer is charged only once." is a bit too broad. We specifically mention network connection errors because idempotency is useful in scenarios where a request fails because your connection to Stripe was lost halfway through the request. You have no way of knowing what specific point the connection dropped off, so you can safely retry the request with the same idempotency key (so if the request did end up reaching stripe the first time around we just send the response from the original request)
Thanks for the feedback @unique hemlock
Lemme ask a more specific question then, if we send a request to Stripe, and Stripe throws an Exception (doesn't matter what that exception was), can we safely assume NOTHING has actually been processed on Stripe's end?
Would the use of an IdempotencyKey have any relevance in this case?
What do you mean by "processed"? Do you mean has a charge actually been made?
I don't know the internals if Stripe, but imagine if a given request to Stripe actually does 2 or 3 actions behind the scenes, if an exception occurs anywhere in this process, is everything rolled back?
Gotcha! So it really depends on the specifics of the action/why it failed - especially for incidents, there are cases where we may roll forward if it's necessary (which is why we alway recommend listening to webhook events https://stripe.com/docs/error-low-level#server-errors)
Thanks @unique hemlock. However the article specifies StripeErrors (Server errors result from a problem with Stripe’s servers. They return an HTTP response with a 5xx error code.)
However, I'm more focused on Exceptions in Stripe. We've identified a (small) percentage of requests to Stripe that throw some sort of Exception.
We've identified some specific workflows and implemented a retry process around handling those Stripe exceptions.
But we just don't quite understand if the idempotency key would help or harm in these retry requests
usually if you get a response, then the idempotency key is just going to replay the same request/error behaviour