Allah Almighty says: "Except for those who repent before you overpower them." [Surah al-Ma'idah: 34]
Imam al-Shafi'i (may Allah have mercy on him), reporting from some of his companions, said that they said: "Every hadd that is a right of Allah Almighty is dropped by the (offender's) repentance, and every right that belongs to people is not annulled."
Imam al-Shafi'i (may Allah have mercy on him) said: "And this is what I hold too."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السرقة / Q17319