#maze260

1 messages ยท Page 1 of 1 (latest)

sturdy sirenBOT
slow ingot
#

Hi ๐Ÿ‘‹ idempotent keys work with all Stripe requests, you can use them for Payment Intents. Are you encountering errors when trying to do so?

surreal idol
#

Hi Toby, Thank you for your response and confirmation. I haven't encountered any errors yet, but when I checked your API reference, the paymentIntents object doesn't have a idempotency property - so that has me thinking an error may arise.

#

Actually, looking again, yes it does have an idempotency_key property : )

#

Everything should be fine then. Thank you : )

slow ingot
#

To clarify, the Payment Intent doesn't have an idempotency property, idempotency keys are not associated to specific objects. Those keys are instead assoicated with a request to our API. If the API detects a key on a request that has already been used, then it serves the response from the previous request instead of processing a new one.

This is discussed in more detail here:
https://stripe.com/docs/api/idempotent_requests

surreal idol
#

Just to clarify (with screenshot). It seems the paymentIntent has a request property, but not an idempotency_key property, but its request property has an idempotency_key property. So that's what I meant but didn't understand until now. I had to look carefully and read your words carefully too : )

slow ingot
#

Hm, interesting, I'm not seeing that field when retrieving a Payment Intent object. I believe those fields belong to the request (it's modeled as an object on our end) rather than the Payment Intent (or other object type) that is created.

surreal idol
#

You are right ... I just checked and the object I was looking at is called the "event" object. My mistake, sorry ... So, if the paymentIntent has no i-key property, how can I make use of the variable please?

#

Metadata?

#

Did everybody's internet crash just now or was it just mine?

slow ingot
#

Make use of what variable?

surreal idol
#

An idempotency-key

#

I learnt how to create one

#

Looking at the Charge object, it doesn't seem to have an idempotency-key property either, but I'm sure the coding was right, so, would the Charge object have been changed, and, if an idempotency-key field is added to a paymentIntent, is it likely to raise an error please?

slow ingot
#

Idempotency keys do not reside on Stripe objects, and never have. They are an attribute of a request, not an object.

#

They are a mechanism that allows you to make a request more than once, and not risk the actual request executing twice. It's intended use is to recover from intermittent network issues where you do not receive a response from us and are unsure of the outcome of the request you made, then you can reuse the idempotent key to safely redo the request. If the first request never reached us, then the request will be executed for the first time. If the previous request reached us and was processed, we reserve the response from the original request rather than processing the request a second time.

surreal idol
#

Thank you for the explanation. I understand all of that from the tutorial. I am still stuck though. So, if an i-key is created, can you suggest to me how it can be used in conjunction with a paymentIntent please? If that involves a request, then how can use the i-key with the payment-intent request please?

#

Actually, don't worry about it. Looking at the coding example, it isn't the Charge that the i-key is working with. So I'll give an improved try and get back to you if there's a problem. My apologies, and thank you for your help today : )

slow ingot
#

All good, I hope I was able to provide some clarity. Do please let us know if there are remaining questions.