The ruling on a bonus (or gratuity) that an employee receives without having asked for it, and which is outside his salary
It is obligatory for a worker to do his work well, because Allah the Exalted certainly loves this.
When any of you does a job, let him do it with skill. If he did the work well and skillfully, and had no greed in his heart for this money, did not fall short, and did not mention it, whether explicitly or by hint, and the employer gave him this money of his own free will, then there is no harm in it. But if he kept being negligent in his work until he was given this money, or he began to say it explicitly or by hinting, then this will be forbidden. And Allah knows best.