There is nothing wrong with accepting the payment from the purchaser in the form of a cheque, even if it is from a riba-based bank, and there is nothing wrong with dealing with riba-based banks in cases of necessity to protect money if there is no Islamic bank, subject to the condition that the money is put in non-interest-bearing accounts in those banks. Please see the answer to question no. 22392.
Engaging in transactions with people who deal with riba or put their money in riba-based banks is permissible. That is indicated by the reports which prove that the Prophet (blessings and peace of Allah be upon him) and his Companions engaged in transactions with the Jews in Madinah although they, as Allah, may He be exalted, has told us, consume unlawful wealth and take riba.
It is permissible with you to sell to this customer who deals with riba, even if he pays from his riba-based account or with a loan that he took from a riba-based bank.
Giving the cheque to the accounts department and transferring the money to the company or to the bank used by the company is not regarded as recording or writing down riba; rather it is writing down and recording the price that was taken in a permissible and Islamically acceptable manner. It makes no difference whether the purchaser pays for it in cash or with a cheque.
Shaykh Ibn Uthaymeen (may Allah have mercy on him) said: It is permissible to engage in transactions with a person who deals with riba, but those transactions should be done in a proper manner. For example, it is permissible to buy from this man who deals with riba, if the product is bought from him in return for money, and it is permissible to take a loan from him, and there is nothing wrong with that. The Prophet (blessings and peace of Allah be upon him) used to engage in transactions with the Jews even though they consumed haraam wealth, and he accepted gifts from them and he accepted their invitations. He sold to them and bought from them. He accepted their gifts, as in the story of the Jewish woman who gave him a (roasted) sheep on the day of the conquest of Khaybar. And he accepted their invitations, as he accepted the invitation of a Jewish boy in Madinah. And he bought food for his family from a Jewish man and gave him his shield in pledge, and he died when his shield was still being held in pledge.
To sum up, if a person earns money from haraam sources, and you engage in a permissible transaction with him, there is nothing wrong with you doing that.
End quote from Fataawa Noor ala ad-Darb
And Allah knows best.
Reproduced from Islam QA