All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Undoubtedly, the good and bad that befall a person are all predestined by Allaah, as Allaah Says (what means): {No disaster strikes upon the earth or among yourselves except that it is in a register before We bring it into being — indeed that, for Allaah, is easy. In order that you not despair over what has eluded you and not exult [in pride] over what He has given you. And Allaah does not like everyone self-deluded and boastful.} [Quran 57:22-23].
If a believer believes that this is a predestined matter, then this will ease his sorrow and lessen his difficulty, and he will not despair of the Mercy of Allaah. However, some of these afflictions may be a punishment and deterrence for committing what Allaah has forbidden and others come as a test for his perseverance; for more benefit, please refer to Fatwa 87608.
As regards the transaction which you mentioned, if you sold the goods to the customer before buying and possessing them, then you have committed something forbidden as this is selling that which you did not possess. A Prophetic narration reads: “Do not sell that which you do not possess.” [Abu Daawood].
It could be that what happened is a warning so that you would stop engaging in such transactions.
However, if you only promised the customer without conducting a sale contract with him, and when you bought the goods, you sold them to him, then this is permissible.
Finally, we ask Allaah to help you and make a way out to your difficulty.