I believe the cards were not written by JK Rowling.
I’m unable to find absolute evidence of this, but there are hints in that direction:
I couldn’t find a single site that said the cards were written by Rowling herself. They all said “based on the books by JK Rowling”. If Rowling herself had written them, surely that would be mentioned somewhere.
The HP Lexicon, which is usually a pretty reliable source, says this of the game:
Please note that the spells and creatures invented by Wizards of the Coast are not canon and are therefore not included in the main sections of the Lexicon.
Unfortunately they don’t provide anything to back this up.
I found this in their FAQs:
Is this really magic?
No. The Harry Potter TCG is simply that – a game. While some of the cards do have spells and potions and other magical terms on them, this simply reflects the wonderful and wondrous world that J. K. Rowling has created around Harry Potter. The Harry Potter TCG is simply a fun way for fans of all ages to pretend for a time that they are a part of this magical world.
If Rowling herself had written them, I’d expect them to state it outright here. That they haven’t makes me suspicious.
I don’t believe Rowling has ever publicly commented about on opinion of the game, or the canonicity of the facts contained within.
I sent an email to the customer service address in that FAQ, pointing them at this question, to ask who wrote the cards. That bounced almost immediately, so I’ve forwarded it to the Wizards of the Coast customer service address. (WoC were the makers of the game.) Unfortunately their response was not forthcoming with any details.