How to get a different idempotency key when correcting errors

I am testing out my web payments sdk connecting to create payment from the payments api, and when I test for an error using incorrect cvc or zip code, and then correct it and try again I get an error returned rror: The provided idempotency key has already been used.

How can I get a new one if someone changes info in the payment form after getting an error?

Idempotency keys can be anything, but they need to be unique. Virtually all popular programming languages provide a function for generating unique strings. You should use one of these language calls.

Language Recommended function
Ruby SecureRandom.uuid
PHP uniqid
Java UUID.randomUUID
Python uuid
C# Guid.NewGuid
Node.js crypto.randomUUID


I get that. I am using a function for that, but then I guess I need to call it again if they provide an incorrect zip code and then correct it? Cause I get an error on the key when trying to resubmit.

Yes, that’s correct after you get a decline from the CreatePayment request. :slightly_smiling_face: