“But indeed, I am the Perpetual Forgiver of whoever repents and believes and does righteousness and then continues in guidance.”{Surah Taha verse 82} The formula to earning Allah’s forgiveness is in this ayah.

Surah [ xaha ] ayah [82] Kuma lalle Nĩ haƙĩƙa Mai gãfara ne ga wanda ya tũba kuma ya yi ĩmãni, kuma ya aikata aikin ƙwarai, sa´an nan kuma ya nħmi shiryuwa.
