Working in the field of recording riba or working out the accounts for it, or writing riba-based contracts, or anything else that helps in riba, is not permissible, because it is cooperating in sin and transgression, but Allaah says (interpretation of the meaning):
“Help you one another in Al‑Birr and At‑Taqwa (virtue, righteousness and piety); but do not help one another in sin and transgression. And fear Allaah. Verily, Allaah is Severe in punishment”
And the Prophet (peace and blessings of Allaah be upon him) cursed the one who consumes riba, the one who pays it, the one who writes it down and the two who witness it, and he said: “They are all the same.” Narrated by Muslim (1598) from the hadeeth of Jaabir (may Allaah be pleased with him).
What you must do is give up working in this field and stick to permissible types of work. Whoever gives up something for the sake of Allaah, Allaah will compensate him with something better than it. See question no. 21113.
Whoever has earned money in a haraam way, such as payments for singing, bribes, payments for fortunetelling and bearing false witness, or for writing down riba and other haraam deeds, then repents to Allaah and regrets what he has done, if he has spent the money then he does not have to do anything, but if the money is in his possession, then he must get rid of it by spending it on charitable causes. If he is in need then he may take as much of it as he needs, and get rid of the rest.
Ibn al-Qayyim (may Allaah have mercy on him) said:
If someone is offered haraam payment and he accepts that, such as a prostitute, a singer, a wine-seller, one who bears false witness etc, then he repents and that payment is in his possession, then some said that he should return it to its owner, because it is his wealth and he did not take it with the permission of the Lawgiver and the person who paid it did not get any permissible benefit in return. Others said that his repentance requires him to give it in charity and not to give it back to the one who gave it to him. This is the view favoured by Shaykh al-Islam Ibn Taymiyah and it is the more correct of the two views. End quote from Madaarij al-Saalikeen (1/389).
Ibn al-Qayyim discussed this issue at length in Zaad al-Ma’aad (5/778), and he stated that the only way to get rid of this wealth and complete one’s repentance is to give it in charity, but if he is in need of it, then he may take as much as he needs, and give the rest in charity. End quote.
Shaykh al-Islam said: If this prostitute and this wine-seller repent, and they are poor, it is permissible to give them as much as they need of this wealth, but if they are able to engage in trade or practise a skill, such as weaving and spinning, they may given enough to form capital. End quote from Majmoo’ al-Fataawa (29/308)
For a more detailed discussion see: al-Riba fi’l-Mu’aamalaat al-Masrifiyyah al-Mu’aasirah by Dr. ‘Abd-Allaah ibn Muhammad al-Sa’eedi (2/779-784).
From the words of Shaykh al-Islam and his student Ibn al-Qayyim quoted above, it may be understood that if the one who repents is in need, then he may take as much as he needs from this wealth, and he may invest some of it as capital in business or a craft.
As some of your work is permissible and some is haraam, you should work out what proportion of it is haraam, and get rid of the appropriate amount of the wealth that is in your possession. If it is too hard for you to work it out, then get rid of half. Shaykh al-Islam (may Allaah have mercy on him) said: If halaal and haraam are mixed together, and he does not know how much of each is present, then he should divide it in half. End quote from Majmoo’ al-Fataawa (29/307).
We ask Allaah to guide you and help you to do that which is in your best interests and will bring you happiness in this world and the next. You may be certain that Allaah is the Provider, the Most Merciful and the Most Generous, and He will not abandon His repentant slave who has turned to Him. Rather He will grant him abundant provision and bless his wealth, and bestow His mercy upon him, because He loves his repentance and rejoices at his regret of sin, and gives a great reward for his repentance. Allaah, may He be exalted, says (interpretation of the meaning):
“Know they not that Allaah accepts repentance from His slaves and takes the Sadaqaat (alms, charity), and that Allaah Alone is the One Who forgives and accepts repentance, Most Merciful?”
“Whoever works righteousness — whether male or female — while he (or she) is a true believer (of Islamic Monotheism) verily, to him We will give a good life (in this world with respect, contentment and lawful provision), and We shall pay them certainly a reward in proportion to the best of what they used to do (i.e. Paradise in the Hereafter)”
“And whosoever fears Allaah and keeps his duty to Him, He will make a way for him to get out (from every difficulty).
3. And He will provide him from (sources) he never could imagine. And whosoever puts his trust in Allaah, then He will suffice him. Verily, Allaah will accomplish his purpose. Indeed Allaah has set a measure for all things”
And Allaah knows best.