Urwah bin al-Zubayr (may Allah have mercy on him) narrated from Sayyidah Aishah (may Allah be pleased with her) that Sayyidah Barirah (may Allah be pleased with her) came to her and said: "O Aishah, I have made a contract of manumission (mukatabah) with my people for seven uqiyyahs, one uqiyyah to be paid each year, so help me." She had not yet paid anything of her contract. Sayyidah Aishah (may Allah be pleased with her), who was keen on her, said: "Go back to your people; if they agree, I will pay them the whole sum at once and your wala' (right of inheritance from the freed slave) will be mine." So Sayyidah Barirah (may Allah be pleased with her) went and put this to her people, but they refused and said: If she wants to do you a kindness seeking reward, let her do so, but your wala' will be ours. Sayyidah Aishah (may Allah be pleased with her) mentioned this to the Messenger of Allah (peace and blessings be upon him), and he (peace and blessings be upon him) said: "Let that not stop you; buy her and set her free, for wala' belongs to the one who sets free." So she did that. The Messenger of Allah (peace and blessings be upon him) stood among the people, praised Allah, and then said: "What is the matter with people who stipulate conditions that are not in the Book of Allah Almighty nor in the Sunnah of His Prophet? Whoever stipulates a condition that is not in the Book of Allah, it is void, even if it be a hundred conditions. Allah's decree is more deserving to be fulfilled and Allah's condition is firmer, and wala' belongs to the one who sets free."
(b) Imam al-Shafi'i (may Allah have mercy on him) said: It has also been narrated from him (peace and blessings be upon him): "The Muslims are bound by their conditions, except a condition that makes the unlawful lawful or the lawful unlawful." And his detailed hadith explains the general one.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصداق / 14432