If one of you marries a woman or buys a slave, he should say: "O Allah, I ask You for the good in her, and in the disposition You have given her; I take refuge in You from the evil in her, and in the disposition You have given her." When he buys a camel, he should take hold of the top of its hump and say the same kind of thing. Abu Dawud said: Abu Sa'id added the following words in his version: He should then tale hold of her forelock and pray for blessing in the case of a woman or a slave. (Using translation from Abū Dāʾūd 2160)
قَالَ رَسُولُ اللهِ ﷺ إِذَا اشْتَرَى أَحَدُكُمُ الْجَارِيَةَ أَوِ الْغُلَامَ أَوِ الدَّابَّةَ فَلْيَأْخُذْ نَاصِيَتَهُ وَلْيَقُلِ اللهُمَّ إِنِّي أَسْأَلُكَ خَيَّرَهُ وَخَيْرَ مَا جُبِلَ عَلَيْهِ وَأَعُوذُ بِكَ مِنْ شَرِّهِ وَشَرِّ مَا جُبِلَ عَلَيْهِ وَإِذَا اشْتَرَى بَعِيرًا فَلْيَأْخُذْ بِذِرْوَةِ سَنَامِهِ وَلْيَقُلْ مِثْلَ ذَلِكَ