Bechoros 29: Paying for Mitzvos (part 1) - Paying a Dayan

If a judge receives payment to judge a din torah his psak is invalidated. The Shulchan Aruch says he is allowed to receive שכר בטלה but it has to be legitimate (he has another job he could be doing).

If a judge does accept payment, does it invalidate his previous dinei torah or only those he adjudicates after receiving payment?

What are the parameters of the prohibition? What if he doesn't receive payment at the time of the din Torah, only later on?