Ayesha reported,

Barirah came and said, "I have made a contract with my masters to buy my freedom for nine ounces of silver, one ounce per year. Please help me."Ayesha said, "If your masters are willing for me to pay the entire amount at once and free you, with your right of inheritance going to me, I will do so."Barirah went to her masters, but they refused. She returned and said, "I presented the offer to them, but they refuse unless the right of inheritance goes to them."The Messenger of Allah ﷺ heard about this and questioned me, so I informed him. He said, "Take her and free her, and let them stipulate whatever they wish about the inheritance, for the right of inheritance belongs only to the one who frees the slave."Ayesha said, the Messenger of Allah ﷺ then stood before the people, praised Allah and glorified Him, then said, "Now then, what is the matter with Some men among you who stipulate conditions that are not found in the Book of Allah? Any condition not found in the Book of Allah is invalid, even if there be a hundred such conditions. Allah's decree is more deserving to be followed, and Allah's condition is more binding. What is the matter with Some men among you, one of whom says, 'Free your slave, so-and-so, but the right of inheritance shall be mine'? The right of inheritance belongs only to the one who frees the slave."

Bukhari 2563

Sahih

حدثنا عبيد بن إسماعيل حدثنا أبو أسامة عن هشام بن عروة عن أبيه

عن عائشة رضي الله عنها قالت

جاءت بريرة فقالت إني كاتبت أهلي على تسع أواق في كل عام وقية فأعينيني فقالت عائشة إن أحب أهلك أن أعدها لهم عدة واحدة وأعتقك فعلت ويكون ولاؤك لي فذهبت إلى أهلها فأبوا ذلك عليها فقالت إني قد عرضت ذلك عليهم فأبوا إلا أن يكون الولاء لهم فسمع بذلك رسول الله ﷺ فسألني فأخبرته فقال خذيها فأعتقيها واشترطي لهم الولاء فإنما الولاء لمن أعتق قالت عائشة فقام رسول الله ﷺ في الناس فحمد الله وأثنى عليه ثم قال أما بعد فما بال رجال منكم يشترطون شروطا ليست في كتاب الله فأيما شرط ليس في كتاب الله فهو باطل وإن كان مائة شرط فقضاء الله أحق وشرط الله أوثق ما بال رجال منكم يقول أحدهم أعتق يا فلان ولي الولاء إنما الولاء لمن أعتق

البخاري 2563صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Mukatab
Chapter
Mukatabʼs seeking help and asking people
Numbering
Darussalam 2563
Bukhari 2563