Aisha said that Barirah came to seek her help in the writing of her emancipation. ʿAisha said to her, "If you wish, I will pay your masters (your price) and the wala' will be for me." When Messenger of Allah ﷺ came, she told him about it. The Prophet ﷺ said to her, "Buy her (i.e. Barirah) and manumit (free) her, for the Wala is for the one who manumits." Then Messenger of Allah ﷺ ascended the pulpit and said, "What about those people who stipulate conditions which are not in Allah's Laws? Whoever stipulates such conditions as are not in Allah's Laws, then those conditions are invalid even if he stipulated a hundred such conditions." (Using translation from Bukhārī 2735)
أَهْلُهَا إِنْ شِئْتِ أَعْطَيْتِ بَاقِي كِتَابَتِهَا وَيَكُونُ لَنَا الْوَلَاءُ فَلَمَّا أَنْ جَاءَ النَّبِيُّ ﷺ ذَكَرَتْ ذَلِكَ لَهُ فَقَالَ «اشْتَرِيهَا فَأَعْتِقِيهَا فَإِنَّ الْوَلَاءَ لِمَنْ أَعْتَقَ» ثُمَّ صَعِدَ رَسُولُ اللهِ ﷺ الْمِنْبَرَ فَقَالَ «مَا شَأْنُ النَّاسِ يَشْتَرِطُونَ شُرُوطًا لَيْسَ فِي كِتَابِ اللهِ مَنِ اشْتَرَط شَرْطًا لَيْسَ فِي كِتَابِ اللهِ لَم يَجُزْ لَهُ وَإِنِ اشْتَرَطَ مِائَةَ شَرْطٍ»