Sahih Bukhari Volume 5, Book 58, Hadith Number 232.

Narated By ‘Ubada bin As-Samit : Who had taken part in the battle of Badr with Allah’s Apostle and had been amongst his companions on the night of Al-‘Aqaba Pledge: Allah’s Apostle, surrounded by a group of his companions said, “Come along and give me the pledge of allegiance that you will not worship anything besides Allah, will not steal, will not commit illegal sexual intercourse will not kill your children, will not utter; slander, invented by yourself, and will not disobey me if I order you to do something good. Whoever among you will respect and fulfill this pledge, will be rewarded by Allah. And if one of you commits any of these sins and is punished in this world then that will be his expiation for it, and if one of you commits any of these sins and Allah screens his sin, then his matter, will rest with Allah: If He will, He will punish him and if He will,. He will excuse him.” So I gave the pledge of allegiance to him for these conditions.