My ticket was definitely valid before I boarded because I had to use it to scan through the barriers to get to the platform. I was trying to purchase the railcard when waiting for the train but don't know exactly when the purchase went through.
What is the time shown on your Railcard purchase confirmation email? This may be important evidence.
What train did you board - was it the 07:22, arriving into Stansted at 07:59? That would tally with the time shown on the Penalty Fare receipt.
Did you have the Railcard downloaded before you boarded the train?
I've checked my bank statement but it doesn't give an exact time either, unfortunately. I showed my railcard at Stansted but she said it wasn't valid.
If you hadn't downloaded the Railcard by the time you boarded the train, you committed an offence under the Railway Byelaws. Byelaw 18(1) makes it an offence to board a train without a valid ticket. Without the required Railcard in your possession
at the time of boarding, your ticket wasn't valid.
However, Penalty Fares operate under a separate set of Regulations to the Byelaws. A PF cannot be issued just because a Byelaw offence has been committed. PFs can only be issued for a failure to show a valid ticket
at the time of the inspection.
We have seen quite a lot of cases of PFs being issued for tickets (or, as in this case, possibly Railcards) being bought after boarding. These PFs are not valid. The correct way for the operator to pursue these cases is through a prosecution for the Byelaw offence (for which they may decide to offer an out of Court settlement, in lieu of prosecution).
There was a sign mentioning you couldn't use Oyster or Contact Less at the barriers but don't think I saw anything about railcards.
There didn't need to be a sign about Railcards specifically. It is taken as a given that you must have a Railcard if you use a Railcard discounted ticket.
However, the legal PF signage requirements (as set out in the linked thread, which I strongly encourage you to read) are not met by having posters that talk about Oyster/contactless in general terms. The PF Regulations require that specific form of wording be required, in addition to other elements such as operator names or branding. In the absence of these requirements being met, the PF is similarly not valid