If a Muslim makes a vow to do a good action if something happens and doesn't make what he has vowed when this thing happens, will Allah punish him by putting a permanent Nifaq in his heart? Why Allah has punished the Munafiqoon by this punishment [9:77]?
Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions. Fulfilling the oath is compulsory for the one who takes the oath. If he cannot fulfill his oath then he has to pay an expiation. If one does not fulfill his oath despite his capability then he commits sin and this sin might be a reason for his bad end as happened to a person whose story is reported in Qur'an. Allah Says (interpretation of meaning): {And of them are some who made a covenant with Allah (saying): If He bestowed on us of His Bounty, we will verily, give Sadaqh (Zakah and voluntary charity in Allah's Cause) and will be certainly among those who are righteous. Then when He gave them of His Bounty, they became niggardly [refused to pay the Sadaqah (Zakah) Then when He gave them of His Bounty, they became niggardly [refused to pay the Sadaqah (Zakah or voluntary charity)], and turned away, averse. So He punished them by putting hypocrisy into their hearts till the Day whereon they shall meet Him, because they broke that (covenant with Allah to their hearts till the Day whereon they shall meet Him, because they broke that (covenant with Allah) which they had promised to Him and because they used to tell lies.}[9:48]. Sometimes Allah bestows blessings upon the one who violates his oath or vow, guides him to the repentance and even accepts his repentance. It is not compulsory that Allah punishes every one who violates his vow or does not keep his promise as He punished the one who is mentioned in the above verse. Allah Says (interpretation of meaning): {Verily, Allah forgives not that partners should be set up with Him (in worship), but He forgives except that (anything else) to whom He wills; and whoever sets up partners with Allah in worship, he has indeed invented a tremendous sin.}[4:48]. Allah knows best.
You can search for fatwa through many choices