Praise be to Allah.
If someone takes wealth belonging to someone else unlawfully, he must return it to him, and his repentance is not complete unless he does that, because of the report narrated by al-Bukhaari (2449) from Abu Hurayrah (may Allah be pleased with him), who said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever had wronged his brother with regard to his honour or anything else, let him put the matter straight with him today, before there will be no dinar or dirham, but if he has righteous deeds to his credit, they will be taken from him commensurate with the wrong he did, and if he has no good deeds to his credit, some of the bad deeds will be taken from the other person and added to his burden.”
An-Nawawi (may Allah have mercy on him) said: The scholars said: Repentance is obligatory from all sins. If the sin was something between a person and Allah, may He be exalted, and had nothing to do with the rights of any human, then there are three conditions: the first is that he must give up the sin, the second is that he must regret having done it, and the third is that he must resolve never to go back to it. If one of the three is omitted, then his repentance is not valid.
If the sin has to do with the rights of another person, then there are four conditions: the three mentioned above, and he must restore the rights of the other person. If it had to do with wealth or property and the like, he must return it to him, and if he slandered him and the like, then he must allow him to retaliate, or ask him to pardon him. If it was the matter of gheebah (speaking ill of him in his absence), then he must ask him to forgive him for it.
End quote from Riyadh as-Saaliheen (p. 33).
If you do not know the amount of money involved, then you must act on the basis of what you think most likely to be the case, whilst erring on the side of caution. If you think the amount is somewhere between eighty and one hundred, then make it one hundred, so that you can be sure that you have done what is required of you.
If you are afraid of negative consequences if you tell the person whom you wronged about what happened, then you do not have to tell him, and it is sufficient for you to make sure that the money reaches him by any possible means, such as putting in his account, or giving it to someone who will make sure it reaches him without telling him.
If the owner of the money has died, then you should give it to his heirs.
If you are not able to find out who the real owner is and deliver the money to him, because you have forgotten his name or for some other reason, after trying your best, then you should give the money in charity on his behalf, with the intention that if you are able to contact him later on, you will give him the choice between approving the charitable donation or taking the money.
It says in Fataawa al-Lajnah ad-Daa’imah about a soldier who stole some money from another person: If he knew the person, or knows someone who knows him, then he must look for him so that he can give his money back to him, either in the form of silver or the equivalent, or whatever he agrees upon with him. If he does not know who he is, and thinks that he will never be able to find him, then he must give it or the equivalent value in paper money in charity on behalf of the owner. Then if he finds him later on, he should tell him what he did, then if he approves of that, all well and good, but if he objects to what he did and asks him for his money, he must give it to him, and what he gave in charity will be to his own credit. He must also ask Allah for forgiveness, repent to Him and pray for the owner of the money.
End quote from Fataawa Islamiyyah (4/165).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: If you stole something from a person or from an organization, then what you must do is get in touch with the person you stole from, and tell him; you can say: I have with me such and such that belongs to you, then you can work out a deal between you and him. But the individual may feel that this is too difficult for him, and that he cannot go – for example – to someone and say, I stole such and such from you, and I took such and such from you. In that case, he can send this money – or whatever – to him by some other, indirect means, such as giving it to a common friend, and telling him that this belongs to So-and-so; he can tell him the story, and say: I have no repented to Allah, may He be glorified and exalted, and I hope that you will give it to him. If he does that, then Allah says (interpretation of the meaning):
“And whoever fears Allah - He will make for him a way out”
“And whoever fears Allah - He will make for him of his matter ease”
If it so happens that you stole from someone who you do not know now, and you do not know where he is, then this is also easier than the first example, because you can give what you stole from him in charity, with the intention that the reward should be for the real owner, and in that case you will have discharged your duty.
The story mentioned by the questioner indicates that one should avoid doing such things, because the person may go through a foolish phase, not caring what he does, and steal things, then after Allah blesses him with guidance, he will now find it hard to resolve the matter.
End quote from Fataawa Islamiyyah (4/162).
We ask Allah to forgive us and you.
And Allah knows best.