All perfect praise be to Allah the Lord of the Worlds. May His peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
Purchasing watermelon under the condition of seeing part of the pulp or under the condition that the pulp is good is called "Purchasing watermelon by cutting it open to make sure that it is good from the inside" is permissible according to Islamic Law. This is because the watermelon is amongst the fruits whose pulp is eaten and it is the right of the buyer to return the watermelon if it was rotten or unripe. This method of purchasing watermelons is customary where the buyer agrees with the seller to return the fruit in case it was unripe or didn`t match the description given by the latter.
It is stated in {Hasheyah ala Nehayat al-Mohtaj, V.4:39}: "The seller isn`t liable for the fruit whose pulp can`t be seen. For example, if he told the buyer that the watermelon is unripe and the buyer bought it and found out that it was unripe, then the latter doesn`t have the right to return it to the former.
It is also stated in {Al-Majmou` fi Takmilat al-Imam al-Sobki, V.12:275}: "Watermelon and pomegranate are amongst the fruits whose pulp can`t be seen. If the purchaser opened such fruit and found that it was rotten, then it is worthless just as rotten eggs. According to al-Shafie and his fellow scholars, the seller must return the money to the buyer."
In conclusion, there is no sin in buying watermelon under the condition of cutting it open. Thus, if it is rotten or defective, then the seller must replace it with a good one. And Allah the Almighty knows best.