This situation can be avoided by using a credit card for the transactions. The irctc will charge your credit card and in case of failed transactions, your card will be credited in a couple of days with the debited amount. So, effectively, you will not have to bother about such transactions while paying the credit card bill.