Ubada bin Samit reported,

We were sitting with the Prophet ﷺ in a gathering when he said, "Give me your pledge that you will not associate anything with Allah, that you will not steal, and that you will not commit adultery." He then recited the entire verse."Whoever among you fulfills this pledge, his reward is with Allah. Whoever commits any of these offenses and is punished for it in this world, that punishment will be his expiation. And whoever commits any of these offenses and Allah conceals it for him, his affair is left to Allah. If He wills, He will forgive him, and if He wills, He will punish him."

Bukhari 6784

Sahih

حدثنا محمد بن يوسف حدثنا ابن عيينة عن الزهري عن أبي إدريس الخولاني

عن عبادة بن الصامت رضي الله عنه قال

كنا عند النبي ﷺ في مجلس فقال بايعوني على أن لا تشركوا بالله شيئا ولا تسرقوا ولا تزنوا وقرأ هذه الآية كلها فمن وفى منكم فأجره على الله ومن أصاب من ذلك شيئا فعوقب به فهو كفارته ومن أصاب من ذلك شيئا فستره الله عليه إن شاء غفر له وإن شاء عذبه

البخاري 6784صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Legal punishments
Chapter
Punishments are expiation
Numbering
Darussalam 6784
Bukhari 6784