The Messenger of Allah ﷺ said, "When two parties enter into a sale, each of them has the option to revoke the transaction as long as they have not parted, unless the sale was concluded with an option to choose. If it was concluded with such an option, then the sale is binding."
أخبرنا علي بن ميمون قال حدثنا سفيان عن ابن جريج قال أملى علي نافع
قال رسول الله ﷺ إذا تبايع البيعان فكل واحد منهما بالخيار من بيعه ما لم يفترقا أو يكون بيعهما عن خيار فإن كان عن خيار فقد وجب البيع
Muslim narrated it in the Book of Trade, Chapter on the Confirmation of the Option of the Session for the Two Parties in a Sale, Hadith: 45/1531, from the hadith of Sufyan bin Uyayna, transmitted through him. It is also in Al-Kubra, Hadith: 6060.