Language:
كتاب الحدود
86  
Limits and Punishments set by Allah (Hudood)
(8)
Chapter: Al-Hudud are expiation
(8)
باب الْحُدُودُ كَفَّارَةٌ
Sahih al-Bukhari 6784

Narrated 'Ubada bin As-Samit:

We were with the Prophet (ﷺ) in a gathering and he said, 'Swear allegiance to me that you will not worship anything besides Allah, Will not steal, and will not commit illegal sexual intercourse." And then (the Prophet) recited the whole Verse (i.e. 60:12). The Prophet (ﷺ) added, 'And whoever among you fulfills his pledge, his reward is with Allah; and whoever commits something of such sins and receives the legal punishment for it, that will be considered as the expiation for that sin, and whoever commits something of such sins and Allah screens him, it is up to Allah whether to excuse or punish him."

حَدَّثَنَا مُحَمَّدُ بْنُ يُوسُفَ، حَدَّثَنَا ابْنُ عُيَيْنَةَ، عَنِ الزُّهْرِيِّ، عَنْ أَبِي إِدْرِيسَ الْخَوْلاَنِيِّ، عَنْ عُبَادَةَ بْنِ الصَّامِتِ ـ رضى الله عنه ـ قَالَ كُنَّا عِنْدَ النَّبِيِّ صلى الله عليه وسلم فِي مَجْلِسٍ فَقَالَ ‏"‏ بَايِعُونِي عَلَى أَنْ لاَ تُشْرِكُوا بِاللَّهِ شَيْئًا وَلاَ تَسْرِقُوا، وَلاَ تَزْنُوا ‏"‏‏.‏ وَقَرَأَ هَذِهِ الآيَةَ كُلَّهَا ‏"‏ فَمَنْ وَفَى مِنْكُمْ فَأَجْرُهُ عَلَى اللَّهِ وَمَنْ أَصَابَ مِنْ ذَلِكَ شَيْئًا فَعُوقِبَ بِهِ، فَهْوَ كَفَّارَتُهُ، وَمَنْ أَصَابَ مِنْ ذَلِكَ شَيْئًا، فَسَتَرَهُ اللَّهُ عَلَيْهِ، إِنْ شَاءَ غَفَرَ لَهُ، وَإِنْ شَاءَ عَذَّبَهُ ‏"‏‏.‏
Reference : Sahih al-Bukhari 6784
In-book reference : Book 86, Hadith 13
USC-MSA web (English) reference : Vol. 8, Book 81, Hadith 775
  (deprecated numbering scheme)