Praise be to Allah.Praise be to Allah.
In a number of previous questions, we have explained the ruling on using credit cards, what is permissible and what is not permissible in that regard.
Please see the answer to question no. 97530.
We have also previously explained that it is permissible for a seller to receive payment from the purchaser who pays using such credit cards, as is the case nowadays in many shops, because the seller is not directly involved in the haram transaction; rather he is receiving what is his due. See the answer to question no. 102744.
With regard to your question, “If the purchaser’s money is haram, then he buys my book through the website, then I take possession of the money, will there be any sin on me?”,
The answer is: your sale is valid and there is no sin on you, because the seller is not required to ask about the source of the money that the purchaser has, or to try to find out about that. If anyone has money, the basic principle is that this money is his, unless proof is established to the contrary.
The fact that a person may acquire some money through unlawful means does not mean that we cannot engage in financial transactions with him. The Muslims used to buy and sell with the Jews, even though they dealt with riba (usury).
Ibn Rajab (may Allah have mercy on him) said: The Prophet (blessings and peace of Allah be upon him) and his companions used to deal with the mushrikeen (polytheists) and the People of the Book even though they were aware that they did not avoid everything haram (in their financial dealings).
End quote from Jaami‘ al-‘Uloom wa’l-Hikam, p. 179.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: With regard to any wealth that is in the hands of the Muslims, Jews and Christians, regarding which we do not know on the basis of evidence or proof that it is seized or acquired unlawfully in such a way that it is not permissible to engage in transactions with the one who seized it, it is undoubtedly permissible to engage in transactions with them on the basis of that wealth, and there is no dispute concerning that among the leading scholars of which I am aware.
End quote from Majmoo‘ al-Fataawa (29/327)
For more information, please see the answer to question no. 13503
And Allah knows best.