What is the best practice to handle http code 502 while creating payment

Dear Team,

We noticed sometimes payment API returned http code 502 while creating payment;
In this situation, both the customer and our application didn’t know the payment result, the customer usually thought the payment is failed, so he paid it again, it might turn out that he paid twice finally.

May I know your suggestion on how our application should handle http code 502 from payment API? we want to ensure the customer make the payment only once.

Thanks in advance.
Best Regards,

In this case you can retry the payment with the same idempotency_key. If the customer was already charged it will just return the payment response. If they weren’t charged we would then process the payment. :slight_smile: