#alexanderg-idmpotncy
1 messages · Page 1 of 1 (latest)
That's not what you'd want to use idempotency for (verifying if something already exists). What are you trying to accomplish, specifically?
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.
The creation call will return the new PaymentIntent in the response if it's successful, or an error if it failed. You'd want to note that PaymentIntent id if you need to use it in a later call.
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)
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.
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
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.
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.
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?
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.