Sunan Ibn Majah, Book 12, Hadith 2337 (In-Book)

It was narrated from 'Amr bin Shu'aib from his father that his grandfather told that the Messenger of Allah said: "When anyone of you buys a slave woman let him say: 'Allahumma inni as'aluka khairaha wa khaira ma jabaltaha alaihi, wa a'udhu bika min sharriha wa sharri ma jabaltaha alaihi (O Allah, I ask You for the goodness within her and the goodness that You have made her inclined towards, and I seek refuge with You from the evil within her and the evil that You have made her inclined towards).' And he should pray for blessing. And if anyone of you buys a camel then he should take hold of its hump and pray for. blessing and say similar words."

حَدَّثَنَا عَبْدُ اللَّهِ بْنُ سَعِيدٍ، حَدَّثَنَا أَبُو خَالِدٍ الأَحْمَرُ، عَنِ ابْنِ عَجْلاَنَ، عَنْ عَمْرِو بْنِ شُعَيْبٍ، عَنْ أَبِيهِ، عَنْ جَدِّهِ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ ‏ "‏ إِذَا اشْتَرَى أَحَدُكُمُ الْجَارِيَةَ فَلْيَقُلِ اللَّهُمَّ إِنِّي أَسْأَلُكَ خَيْرَهَا وَخَيْرَ مَا جَبَلْتَهَا عَلَيْهِ وَأَعُوذُ بِكَ مِنْ شَرِّهَا وَشَرِّ مَا جَبَلْتَهَا عَلَيْهِ وَلْيَدْعُ بِالْبَرَكَةِ وَإِذَا اشْتَرَى أَحَدُكُمْ بَعِيرًا فَلْيَأْخُذْ بِذِرْوَةِ سَنَامِهِ وَلْيَدْعُ بِالْبَرَكَةِ وَلْيَقُلْ مِثْلَ ذَلِكَ ‏" ‏ ‏.‏

sunnah.com