Metamask is giving me that error. I am on ropsten network, I never had this issue before and I have enough funds:
I have tried multiple times still getting same error. While it says "I will try anyway",
confirm button was disabled
What probably happens is that Metamask runs a static call to the contract with the same parameters, to simulate what would happen if the transaction took place. If it notices that the static call reverts, it gives you this error - because most likely the real transaction would revert as well.
So most likely there is something in the code which causes a revert with the given parameters.
the problem was with my json data. I have this code in
const hexBookId = web3.utils.utf8ToHex(book.id);
in json.data for first three items I had correct id type:
"id": "2". I could successfully purchase first 3 books. After the third one, I had this
So when I click on the purchase button, I was getting errors. I corrected the json data