Ayesha reported,

Barirah came to me and said, "I have made a contract with my owners to buy my freedom for nine ounces of silver, one ounce to be paid each year. Help me."I said, "If your owners are willing for me to pay the whole amount at once and have your loyalty belong to me, I will do it."Barirah went to her owners and told them, but they refused. She came back from them while the Messenger of Allah ﷺ was sitting there, and she said, "I offered that to them, but they refused unless the loyalty goes to them."The Prophet ﷺ heard this, and Ayesha informed the Prophet ﷺ of the matter.He said, "Take her and stipulate the loyalty for them, for loyalty belongs only to the one who frees the slave."So Ayesha did that. Then the Messenger of Allah ﷺ stood before the people, praised Allah and glorified Him, then said, "Now then, what is the matter with Some men who lay down conditions not found in the Book of Allah? Any condition not found in the Book of Allah is invalid, even if it be a hundred conditions. Allah's decree is more deserving, and Allah's condition is more binding. Loyalty belongs only to the one who frees the slave."

Bukhari 2168

Sahih

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

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

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

البخاري 2168صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Sales
Chapter
If conditions are stipulated in a sale that are not lawful
Numbering
Darussalam 2168
Bukhari 2168