Upvote:2
There is an extensive account of how to buy Indian rail tickets on the website of the man in seat 61.
https://www.seat61.com/India.htm#Buy-tickets-online
It is far too long and complex to sumarise here but basically you either use an independent agency which charges a small fee or you register on the official railway site. He also provides a whole list of things which can go wrong with suggested remediation actions.