What is idempotency?

You might ignore idempotency but not when you are a fintech. Dealing with payments and not building idempotent APIs could be a nightmare.

But, What are idempotent APIs? An idempotent API endpoint is one that can be called any number of times while guaranteeing that the operation will occur only once.

How to design an idempotent payment API?

  1. Generate an idempotent key at the server side.

  2. Send it along with the payment request.

  3. Validate it before starting the payment process.

  4. Refer to the flow diagram below.

Written by - Dishant Sethi


Enjoyed the blog? If so, you'll appreciate collaborating with the minds behind it as well.

Last updated