Compensation for a Mitzvah

If a shadchan gets compensation for making a shiduch does he lose some of his reward in olam Haba? Does a Rebbi get reward for teaching Torah if he is getting a salary?

Machloket. Magen Avraham says depends on his intentions, if the intention was for money then they do lose some of the mitzvah. Biur Halacha allows if its a mitzva
Q – well making a shiduch is always a mitzvah no?
Why is it then a halacha that you must pay a shadchan if it is a machloket?
A – You definitly must pay for work that was done to you but the question is would the shadchan receive his full reward