Ruling on working in a factory that makes bank machines (ATMs)
Question

What is the ruling on working in a factory that makes bank machines (ATMs)? Please note that we do not know whether they will be bought by a bank that is riba-based or one that is not, although most of the banks in our country are riba-based and I am not actually making the machines, but I work in the same factory.
Praise be to Allah.If these machines are used for riba-based transactions, lending or borrowing, it is not permissible to manufacture them or to sell them to those who it is known that they will use them for riba, because Allah, may He be exalted, says (interpretation of the meaning): {And cooperate in righteousness and piety, but do not cooperate in sin and transgression} [al-Ma’idah 5:2].
Making them for the riba-based bank comes under the heading of cooperating with them in this major sin, namely riba, concerning which there is a stern warning that is not issued concerning other sins.
Allah, may He be exalted, says (interpretation of the meaning):
{O you who have believed, fear Allah and give up what remains [due to you] of interest, if you should be believers
And if you do not, then be informed of a war [against you] from Allah and His Messenger}
[al-Baqarah 2:278-279].
Muslim (1598) narrated that Jabir (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah 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.”
And he (blessings and peace of Allah be upon him) said: “A dirham of riba consumed by a man knowingly is worse before Allah than thirty-six acts of zina.” Narrated by Ahmad and at-Tabarani; classed as sahih by al-Albani in Sahih al-Jami‘, no. 3375.
As for making these machines for Islamic banks, or for a riba-based bank which is not going to use it for riba-based transactions – rather it will use it for permissible purposes, such as withdrawing from the balance in a person’s bank account or paying bills, and the like – there is nothing wrong with manufacturing them and selling them to them, even if the bank is riba-based. That is because there is nothing wrong with dealing with a riba-based bank for permissible transactions such as buying and selling, so long as that has nothing to do with riba. The Prophet (blessings and peace of Allah be upon him) used to deal with the Jews, buying and selling, even though they consumed riba. Please see the answer to question no. 39661 .
If you are not sure about the bank which is going to buy the machines, then you should act on the basis of what is most likely to be the case. If it is most likely that the bank will use the machines for haram purposes, then manufacturing them and selling them is haram; but if it is most likely that it will use them for permissible matters, then manufacturing them and selling them is permissible.
And Allah knows best.