Sahih Muslim 1504 b
'A'isha (Allah be pjeased with her) reported that Barira came to her in order to seek her help in securing freedom, but she had (so far) paid nothing out of that sum stipulated in the contract. 'A'isba said to her. Go to your family (who owns you), and if they like that I should pay the amount (of the contract) on your behalf (for purchasing your freedom), then I shall have the right in your inheritance. (If they accepted it) I am prepared (to make this payment). Barira made a mention of that to the (members of) her family, but they refused and said:
If she (Hadrat 'A'isha) wants to do good to You for the sake of Allah, she may do it, but the right of inheritance will be ours. She (Hadrat 'A'isha) made a mention of that to Allah's Messenger (ﷺ), and he said to her: Buy her, and emancipate her, for the right of inheritance vests with one who emancipates (the slave). Allah's Messenger, may peace be upon him) then stood up and said: What has happened to the people that they lay down conditions which are not (found) in the Book of Allah? And he who laid down a condition not found in the Book of Allah, that is not valid. even if it is laid down hundred times. The condition laid down by Allah is the most weighty and the most valid.
وَحَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا لَيْثٌ، عَنِ ابْنِ شِهَابٍ، عَنْ عُرْوَةَ، أَنَّ عَائِشَةَ، أَخْبَرَتْهُ أَنَّ بَرِيرَةَ جَاءَتْ عَائِشَةَ تَسْتَعِينُهَا فِي كِتَابَتِهَا وَلَمْ تَكُنْ قَضَتْ مِنْ كِتَابَتِهَا شَيْئًا فَقَالَتْ لَهَا عَائِشَةُ ارْجِعِي إِلَى أَهْلِكِ فَإِنْ أَحَبُّوا أَنْ أَقْضِيَ عَنْكِ كِتَابَتَكِ وَيَكُونَ وَلاَؤُكِ لِي ‏.‏ فَعَلْتُ فَذَكَرَتْ ذَلِكَ بَرِيرَةُ لأَهْلِهَا فَأَبَوْا وَقَالُوا إِنْ شَاءَتْ أَنْ تَحْتَسِبَ عَلَيْكِ فَلْتَفْعَلْ وَيَكُونَ لَنَا وَلاَؤُكِ ‏.‏ فَذَكَرَتْ ذَلِكَ لِرَسُولِ اللَّهِ صلى الله عليه وسلم فَقَالَ لَهَا رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ ابْتَاعِي فَأَعْتِقِي ‏.‏ فَإِنَّمَا الْوَلاَءُ لِمَنْ أَعْتَقَ ‏"‏ ‏.‏ ثُمَّ قَامَ رَسُولُ اللَّهِ صلى الله عليه وسلم فَقَالَ ‏"‏ مَا بَالُ أُنَاسٍ يَشْتَرِطُونَ شُرُوطًا لَيْسَتْ فِي كِتَابِ اللَّهِ مَنِ اشْتَرَطَ شَرْطًا لَيْسَ فِي كِتَابِ اللَّهِ فَلَيْسَ لَهُ وَإِنْ شَرَطَ مِائَةَ مَرَّةٍ شَرْطُ اللَّهِ أَحَقُّ وَأَوْثَقُ ‏"‏ ‏.‏