It is narrated from Sayyiduna Samurah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "The buyer and the seller both have the option (to cancel) as long as they have not separated, and each of them should take (benefit) from the sale according to what he is pleased with."
Hadith Referenceالمعجم الكبير للطبراني / باب السين / 6805