I heard the Messenger of Allah ﷺ say, "The circumambulation of the Kaabah, the walking between Safa and Marwa, and the throwing of the pebbles were ordained only for the establishment of the remembrance of Allah ."
حدثنا محمد بن بكر قال أخبرنا عبيد الله بن أبي زياد قال حدثنا القاسم بن محمد
سمعت رسول الله ﷺ يقول إنما جعل الطواف بالكعبة وبين الصفا والمروة ورمي الجمار لإقامة ذكر الله عز وجل
Its chain of transmission is hasan due to Ubaydullah bin Abu Ziyad, who is al-Qaddah, about whom there is some criticism, but he is corroborated and his hadith has supporting evidence. The hadith was mentioned earlier at 24232.