ERC20: transfer amount exceeds balance

Hi @Aymane,

Welcome to the community :wave:

If you use transfer then the contract needs to hold tokens.
If you use transferFrom then the token holder needs to have approved an allowance of tokens for the contract to transfer.

I suggest looking at: Example on how to use ERC20 token in another contract

Depending on your use case you may actually want three contracts, an ERC20, and ERC721 and a sale contract that accepts ERC20 and mints (or transfers) ERC721. I recommend only including functionality in a contract needed for the life of the contract, so sale functionality may not always be needed in the ERC721.