Sobes.tech
Middle

The same payment request was received twice. What should happen?

sobes.tech AI

Answer from AI

If the same payment request is received twice, the system should ensure idempotency of the operation to prevent double payment. Usually, a unique transaction identifier (e.g., paymentId) is used, which is checked during request processing. If a request with such an identifier has already been processed, the system returns the result of the previous operation without re-deducting funds.

Example approach:

  • The client generates a unique paymentId and sends it along with the request.
  • The server checks if a record with this paymentId already exists.
  • If it does — it returns a successful payment status without re-deducting.
  • If not — it processes the payment and saves the paymentId.

This prevents duplicate payments on repeated requests.