The Messenger of Allah ﷺ said that Allah , whose word is truth, said, "When My servant intends to do a good deed, record it for him as one good deed. If he carries it out, record it for him tenfold. When he intends to do an evil deed, do not record it. If he carries it out, record it as a single evil deed. If he refrains from it" — and sometimes he said, "if he does not act upon it" — "then record it for him as a good deed."Then he recited, "Whoever brings a good deed shall have ten times its like" [Anam 6:160].
حدثنا ابن أبي عمر حدثنا سفيان عن أبي الزناد عن الأعرج
أن رسول الله ﷺ قال قال الله عز وجل وقوله الحق إذا هم عبدي بحسنة فاكتبوها له حسنة فإن عملها فاكتبوها له بعشر أمثالها وإذا هم بسيئة فلا تكتبوها فإن عملها فاكتبوها بمثلها فإن تركها وربما قال لم يعمل بها فاكتبوها له حسنة ثم قرأ {من جاء بالحسنة فله عشر أمثالها}
Agreed upon [by Bukhari and Muslim]. Muslim reported it in the Book of Faith, Chapter "If a servant intends a good deed it is recorded, and if he intends a bad deed it is not recorded," hadith 128, from the narration of Sufyan bin Uyayna, and Bukhari, hadith 7501, from the narration of Abu Zinad, with the same wording.