How can I prevent duplicate charge using Stripe?

Disabling the form submission after the first click is definitely the easiest way to implement this.

Another approach is to use idempotent requests as documented here. The idea is that you pass a unique identifier when making a request to Stripe's API that ensures you can only run this transaction once. If you re-run the query with the exact same idempotency key you will get the original response from the first call which ensures you never have 2 charges created for the same "transaction" on your website.


yes idempotent request is correct way to implement this.

you can refer this here

https://stripe.com/docs/api#idempotent_requests

another simple solution which you can implement is use of state machine by keeping track of stripe api call.