Selling a bookkeeping program to one who sells books that go against the ‘aqeedah of Ahl al-Sunnah
Question

                We are a company working in the field of making and selling programs (for bookkeeping and inventory control). We have the opportunity to sell programs to a bookshop and stationer belonging to one of the followers of bid’ah who curse the companions and wives of the Prophet (peace and blessings of Allaah be upon him). He is going to sell books that speak of his madhhab and its ideas that go against sharee’ah. Is that permissible? Is there any sin on us? If we sell to him, are we helping him to spread his false beliefs? Even though they will only be sold to their own followers, and we are simply helping him to get organized and keep track of sales. Please note that we will give a large amount of charity, equal to the amount of sales, for this reason.
Praise be to Allah.It is not 
    permissible for you to sell these programs to one who you know will use them 
    to commit sin, such as selling them to riba-based banks or to those who will 
    use them to sell books that go against the ‘aqeedah of Ahl al-Sunnah 
    wa’l-Jamaa’ah, because that is cooperating in sin and transgression, and 
    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”

    [al-Maa’idah 5:2]
The fuqaha’ 
    stated that it is not permissible to sell or rent to anyone if it is known 
    that he will use it for sinful purposes. 
Ibn Qudaamah 
    (may Allaah have mercy on him) said: To sum up, selling fruit juice to one 
    who is certain to use it to make alcohol is haraam. Then he said: The same 
    ruling applies in all cases where the aim is something haraam, such as 
    selling weapons to those who are at war with the Muslims, or to bandits, or 
    at times of fitnah, or selling slave women to become sinners, or renting 
    them out for such purposes, or renting out one’s property for alcohol to 
    sold from it, or to be used as a church, and so on. This is haraam, and the 
    contract is invalid. End quote from al-Mughni (4/154). 
Shaykh 
    al-Islam Ibn Taymiyah (may Allaah have mercy on him) said: It is not valid 
    to sell to one who intends to use it for haraam purposes, such as selling 
    fruit juice to one who will use it to make alcohol, if that is known, 
    according to the view of Ahmad and others, or if it is thought most likely, 
    as is one of the two views narrated from Ahmad. This is supported by the 
    fact that our companions said: If the landlord thinks that the renter will 
    rent the building for sinful purposes, such as selling alcohol and the like, 
    it is not permissible for him to rent that building to him, and the rental 
    contract is not valid. Selling and renting are the same. End quote from 
    al-Fataawa al-Kubra (5/388). 
He also said 
    in Sharh al-‘Umdah (4/386): All clothing which it is thought must 
    likely will be used for sinful purposes, it is not permissible to sell it or 
    sew it for one who will use it for sinful purposes and wrongdoing. End 
    quote. 
It says in
    al-Mawsoo’ah al-Fiqhiyyah (9/213): The majority are of the view that 
    everything that is intended for haraam purposes, and every transaction that 
    leads to sin is haraam, so he should refrain from selling anything where it 
    is known that the purchaser intends to use it for something that is not 
    permissible.  
End quote 
    from al-Mawsoo’ah al-Fiqhiyyah al-Kuwaitiyyah. 
The 
    questioner should note that whoever gives up something for the sake of 
    Allaah, Allaah will compensate him with something better than it, as is 
    narrated in a saheeh report from our Prophet  (peace and blessings of 
    Allaah be upon him), and that what is with Allaah cannot be attained except 
    by obeying Him, as the Prophet  (peace and blessings of Allaah be upon 
    him) said: “The Holy Spirit (Jibreel) has inspired to me that no soul will 
    die until it has completed its appointed term and received its provision in 
    full, so fear Allaah and do not be desperate in seeking provision, and no 
    one of you should be temped to seek provision by means of committing sin if 
    it is slow in coming to him, for that which is with Allaah can only be 
    attained by obeying Him.” Narrated by Abu Na’eem in al-Hilyah from 
    the hadeeth of Abu Umaamah; classed as saheeh by al-Albaani in Saheeh 
    al-Jaami’, no. 2085. 
And Allaah 
    says (interpretation of the meaning): 
“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”

    [al-Talaaq 65:2-3]
We ask 
    Allaah to help and guide us and you. 
And Allaah knows 
    best.