Sahih Muslim Book 27, Hadith 47
This hadith has been narrated through another chain of transmitters with a slight variation of words.
I have caused you pain. He said: No. But he (Ibn Umar) said: You are free. He then took hold of something from the earth and said: There is no reward for me even to the weight equal to it. I heard Allah's Messenger (ﷺ) as saying: He who beats a slave without cognizable offence of his or slaps him (without any serious fault), then expiation for it is that he should set him free.
I slapped a slave belonging to us and then fled away. I came back just before noon and offered prayer behind my father. He called him (the slave) and me and said: Do as he has done to you. He granted pardon. He (my father) then said: We belonged to the family of Muqarrin during the lifetime of Allah's Messenger (may peace be upon him. and had only one slave-girl and one of us slapped her. This news reached Allah's Apostle (ﷺ) and he said: Set her free. They (the members of the family) said: There is no other servant except she. Thereupon he said: Then employ her and when you can afford to dispense with her services, then set her free.