Praise be to Allah, prayer and peace be upon the Prophet of Allah.
An employee who is subscribed to the Social Security pays part of his salary to security fund deducted by the employer, and the employer pays the other part. When the employee reaches a certain age he/she deserves a retirement salary. Sometimes the employee pays the full amount, and the employer does not pay anything. If the money is returned, and the employee had paid all the money, then all the money is returned to him. Neither the company nor the partner is entitled to take anything of the money returned.
And if the company paid the money, then it is returned all to the company. But if the subscription is paid partly by the subscriber and partly by at the company, the amount that was paid by the employee shall be paid back to him.
And the amount that the company paid must be given back to the company as it happened by mistake, and what happened by mistake does not become a property of the recipient. Allah Says [Al-Nisaa'/ 4]: "oh you who believe, eat not up your money among you in vanities" (Qur'an 4: 29). And God knows.