Mishkat al-Masabih 567
وَعَنْ أَنَسٍ قَالَ: جَاءَ رَجُلٌ فَقَالَ يَا رَسُولَ اللَّهِ إِنِّي أَصَبْتُ حَدًّا فأقمه عَليّ قَالَ وَلم يسْأَله عَنهُ قَالَ وَحَضَرَتِ الصَّلَاةُ فَصَلَّى مَعَ رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَلَمَّا قَضَى النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ الصَّلَاة قَامَ إِلَيْهِ الرَّجُلُ فَقَالَ يَا رَسُولَ اللَّهِ إِنِّي أَصَبْتُ حَدًّا فأقم فِي كتاب الله قَالَ أَلَيْسَ قَدْ صَلَّيْتَ مَعَنَا قَالَ نَعَمْ قَالَ فَإِنَّ اللَّهَ قَدْ غَفَرَ لَكَ ذَنْبَكَ أَو قَالَ حدك
From Anas, who said: A man came and said: "O Messenger of Allah, I have committed something deserving a prescribed punishment, so carry it out on me." He said: And he did not ask him about it. He said: The time of prayer came, and he prayed with the Messenger of Allah ﷺ. When the Prophet ﷺ finished the prayer, the man stood up to him and said: "O Messenger of Allah, I have committed something deserving a prescribed punishment, so carry out [on me what is] in the Book of Allah." He said: "Did you not pray with us?" He said: "Yes." He said: "Then Allah has forgiven you your sin," or he said: "your punishment."