#EmpowerJohn-idempotencykeys

1 messages · Page 1 of 1 (latest)

thick maple
#

Hi there!

#

Yes, if you retry a request within 24hours with the same idempotency key then the same response will be returned without the request actually running.

hollow nymph
#

But in this particular case, Stripe doesn't actually return a response (for the given request), it throws an Exception
So the request was never completed on Stripe's end. Does this still hold true?

sly berry
#

👋 Hopping in here since @thick maple had to head out

hollow nymph
#

There's no way for me to test this particular scenario since the Exception is triggered within Stripe's workflow

sly berry
#

The response we send back is the Exception though - just because you get back an Exception doesn't mean the request wasn't complete. It means that the request is complete but ultimately failed (and that's the response we'll replay when you retry the request)

hollow nymph
#

is there anyway whatsoever to setup some sort of test around this scenario?

sly berry
#

What specific aspect of this are you trying to test? You could try something like creating a Payment Intent for a specific customer + Payment Method with an idempotency key, detach the Payment Method from the customer, and then compare the responses when replay the request (with the same idempotency key) vs a different one

hollow nymph
#

I'd like to have some sort of integration setup for a given request to Stripe that always throws an Exception:

  • so we can test how to handle that on our end
  • so we can have full scope of what a Stripe Exception returns
sly berry
#

Sorry I missed this follow-up

hollow nymph
#

But won't this simply return a 400 / 500 response?

lime otter
#

@hollow nymph just to clarify, the "exception" you're referring to, you mean something inside the Stripe server-side library you're using, meaning before a request goes out to Stripe?

#

I'm trying to understand what you're trying to test

#

the way I read you is that you don't want to test a 400'ing or 500'ing HTTP response from Stripe

#

but something else , not sure what that is

hollow nymph
#

Sorry, let me clarify:
My company integrates Stripe using the .NET SDK

#

When we make requests to Stripe, 99% of the time we receive a valid Stripe response. That response can be a Successful response (all OK) or an Unsuccessful response (maybe some sort of validation failed and 400 was returned)

#

However, every now and then, a request throws an Exception

#

And again, I'm specifying EXCEPTION - different than returning a valid Response