It's perfectly acceptable to buy the tickets online first and buy the railcard later - just as long as you have it when boarding the train. All I have to say is that you must have the railcard with you when you travel as the rail ticket without the railcard will then be invalid.