Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:9:75

And among them are those who made a covenant with Allah, ˹saying˺, "If He should give us from His bounty, we will surely spend in charity, and we will surely be among the righteous."  

And some of them have made a covenant with God ˹saying˺: ‘If He gives us of His bounty, we will give voluntary alms (la-nassaddaqanna: the original tā’ ˹of natasaddaqanna˺ has been assimilated with the sād) and become of the righteous’: this was Tha‘laba b. Hātib, who asked the Prophet (s) to supplicate on his behalf so that God would give him wealth, of which he would give every needy person his due. He ˹the Prophet˺ thus supplicated for him and he became wealthy, but stopped attending the Friday prayer and congregational prayers and refused to pay the alms-tax, as God, exalted be He, says:
القرآن:٩:٧٥

وَمِنْهُمْ مَنْ عَاهَدَ اللَّهَ لَئِنْ آتَانَا مِنْ فَضْلِهِ لَنَصَّدَّقَنَّ وَلَنَكُونَنَّ مِنَ الصَّالِحِينَ  

{ومنهم من عاهد الله لئن آتانا من فضله لنصًّدقن} فيه إدغام التاء في الأصل في الصاد {ولنكونن من الصالحين} وهو ثعلبة بن حاطب سأل النبي ﷺ أن يدعو له أن يرزقه الله مالا ويؤدي منه كل ذي حق حقه فدعا له فوسع عليه فانقطع عن الجمعة والجماعة ومنع الزكاة كما قال تعالى.