#alexanderg-idmpotncy

1 messages · Page 1 of 1 (latest)

chrome nexus
#

That's not what you'd want to use idempotency for (verifying if something already exists). What are you trying to accomplish, specifically?

verbal quiver
#

I need to know if on a given create call I have actually created payment intent in Stripe, rather than picking up an existing one which might have been created a while ago.

chrome nexus
verbal quiver
#

I understand this. I need to know on a second call with the same data that a payment intent was not actually created in stripe during this call and a payment intent which was created an hour ago is returned.

#

Example: call 1 - payment intent created and return, call 2 in one hour - same payment intent is returned (not created)

chrome nexus
#

Idempotent requests will not indicate if the earlier tries were successful or not. What you can do is look at the created timestamp in the PaymentIntent object to know when it was created.

verbal quiver
#

The issue I have is that the calls a being dups and have milliseconds in between so this would not give much. Is there anything else I could use from Stripe API

#

in the same create call, without making other calls

chrome nexus
#

What are you trying to accomplish that would result in making subsequent idempotent requests that quickly? Normally you'd only retry a request in response to the initial one failing.

verbal quiver
#

I am not trying to achieve this - this is a software quality issue we need to consider on our end and account for depending on what Stripe API has to offer.

chrome nexus
#

Right but when you say you need to know whether the PaymentIntent existed already or not, why is that? What goal do you have that requires knowing if the PaymentIntent was created previously with idempotent requests?

verbal quiver
#

So that we do not persist the second entry in our DB. We can address it on our end, but my hope was that Stripe would have a flag on PaymentIntent returned to indicate whether it was actually created, because what happens is actually an implicit get instead of create.

chrome nexus
#

I'd say you should make sure you're only persisting any given PaymentIntent id once in your database (verify it doesn't exist already before trying to save it again)

#

Using idempotency won't give you an indicator of if it already existed before retrying the call.