I suspect an integrated national railway would develop their on line ticket purchasing system where the railcards were registered back to a single database integrated with your ticket sales software, so that if you set it up properly would know that your railcard was invalid and help prevent such errors occurring, but we don't seem to have that sort of approach in UK sadly for reasons no doubt outside the scope of this thread!
From another thread...
Railcards all carry an ID number (do ones sold at stations?). The plastic cards don't have a machine readable code, but the digital on phone ones do (don't know the type of code).
Given this, certainly online, why don't we ask people to 'add' a Railcard to their account and validate the ID provided against the database that exists?
Advantages:
- lots of metadata for RDG
- a degree of fraud prevention/mapping
- prevent innocent mistakes such as using an invalid Railcard etc.