Ayesha reported,

Barirah came to Ayesha while she was a slave under a contract of emancipation, her owners having agreed to free her for nine ounces of silver. Ayesha said to her, "If your owners agree, I will pay them the full sum at once, and the right of guardianship will belong to me."So Barirah went to her owners and mentioned this to them, but they refused unless the right of guardianship were stipulated for them. Ayesha mentioned this to the Prophet ﷺ, who said, "Go ahead."Then the Prophet ﷺ stood up and addressed the people. He praised Allah and extolled Him, then said, "What is the matter with Some men who stipulate conditions 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. The Book of Allah has the greater claim, and the condition of Allah is the firmer. The right of guardianship belongs to the one who frees the slave."

Ibn Majah 2521

Sahih

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

عن عائشة زوج النبي ﷺ

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

ابن ماجه 2521صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Emancipation of slaves
Chapter
Mukatab
Numbering
Darussalam 2521
Ibn Majah 2521