I've recently added FTM payments to my website and discovered once the transaction is sent to MetaMask everything goes to plan but looking at the image below, Users can directly edit the amount sent using the edit button. I want to charge a fixed amount which can't be edited. How can I achieve this?
1 Answer
You can't do this when initiating a transfer from one wallet to another. You can only achieve this by interacting with smart contracts. In your case, once the transaction is confirmed, you need to validate if the amount sent is the amount you are expecting.
-
Firstly, thank you for your reply. This is strange, when I have initiated transactions on other platforms using metamask there is no edit button. But what you are saying is, once the user has sent the transaction and the transaction ID is created. I need a separate process which confirms the correct amount has been sent. The problem with this is, the transaction will still go through and the incorrect amount will still be sent to the receiving wallet and this will have to be dealt with manually. Is this correct or am I missing something here? Thanks again.– ozftmCommented Aug 2, 2022 at 10:06
-
Even if you would hide that option (I am not aware of this being possible), then someone could still bypass that and transfer funds. I see two potential ways to deal with this: 1. If someone changes the amount to be sent, it's on them. You can then send the funds back manually by discounting gas fees from the amount. 2. Build a smart contract that would reject transactions with incorrect amount (then nobody can send incorrect amount). Is the amount a constant or it keeps changing?– DarkerCommented Aug 2, 2022 at 10:11
-
Here's where I can see the option is hidden in MM: imgur.com/a/pDFgTjW My value will be constantly changing as I'm charging an amount based on quantity, and this will then change based on the price of FTM.– ozftmCommented Aug 2, 2022 at 10:20
-
I can't see the image well. It's cropped, only top is visible.– DarkerCommented Aug 2, 2022 at 10:21
-
My mistake, here's a better image of the transaction in MM: imgur.com/a/79RZy0A This is using ZooDex– ozftmCommented Aug 2, 2022 at 10:25