If you paid with Credit Card, you will get your money back from the Credit Card Issuer Bank. Some times, it happens automatically, sometimes you may have to hustle a bit. As I highlighted in Why Two Factor Authentication Is A “Conversion Killer” & “Blood Pressure Booster”,

Failed payments fall into a “CyberAbyss” of sorts, which comprises Collection Account of Merchant, Nostro Account of Sender Bank at Scheme Operator, Nostro Account of Beneficiary Bank at Scheme Operator, Internal Collection Accounts at Sender Bank and Beneficiary Bank, Scheme Operator Account, Unintended Beneficiary’s Account, and dozens of other nooks and crannies in the payment value chain.

Some Merchants / Issuers use sophisticated tools and are mindful about Customer Experience. They will be able to ferret out failed payments from the CyberAbyss and reprocess them quickly. Others don’t and won’t, so failed payments will remain stuck in the CyberAbyss for a long time.

Consumers of the first cohort will get their money back in their accounts automatically within a few days. Consumers of the second cohort will be made to run from pillar to post between the Issuer and the Merchant for several months to get a refund.

If you paid with UPI or any other Account-to-Account Real Time Payment method, you probably need to be prepared to kiss your money goodbye. They’re irrevocable payment methods. The fact that you have made the payment twice – for whatever reason – is deemed as confirmation of your intent to buy twice and pay twice. More details in my another answer Ketharaman Swaminathan’s answer to How do I revert an online transaction which is done by using UPI ID mistakenly?.