#Staberinde-idempotency-key

1 messages · Page 1 of 1 (latest)

brave barn
#

Hi there, we pass idempotency keys for you by default on StripeJS requests.

#

Can you tell me more about what you are concerned about here?

humble mesa
#

I'm running into a scenario where we attach duplicate payment methods to a customer.

In our current setup, we create the payment method on the front end, using the StripeJS library. Which returns a paymentMethodId.

We then pass the paymentMethodId, to the backend, which then attaches it to the customer. After attaching the payment method, we do a "bunch of other things".

If an error occurs during the "bunch of other things", we refresh the page, and ask the user to submit again. This is where the duplicate paymentMethod is created.

brave barn
#

Gotcha, idempotency isn't going to help with that any way. It would only affect retries due to network errors.

#

In this case you want to deduplicate on the backend

#

You will look at the fingerprint on the payment method

#

And determine if you already have collected one with that same fingerprint

humble mesa
#

Ah great, thank you, I think that'll do it.