The Prophet ﷺ said, "When one of you marries a woman or purchases a servant, let him say, 'O Allah, I ask You for her good and the good of the disposition You have given her, and I seek refuge in You from her evil and the evil of the disposition You have given her.' And when he buys a camel, let him take hold of the top of its hump and say the same."
حدثنا عثمان بن أبي شيبة وعبد الله بن سعيد قالا حدثنا أبو خالد يعني سليمان بن حيان عن ابن عجلان
عن النبي ﷺ قال إذا تزوج أحدكم امرأة أو اشترى خادما فليقل اللهم إني أسألك خيرها وخير ما جبلتها عليه وأعوذ بك من شرها ومن شر ما جبلتها عليه وإذا اشترى بعيرا فليأخذ بذروة سنامه وليقل مثل ذلك
[Hasan] Reported by Ibn Majah, Nikah, chapter on what a man says when his wife is brought in to him, no. 1918, and Bukhari in Khalq Afal Abbad, p. 40, from the hadith of Muhammad bin Ajlan, with the same wording. In Bukhari's version, the transmitter explicitly stated that he heard it directly. Hakim graded it sahih (2/185, 186), and Dhahabi agreed with him.