0

I want to add some javascript to my site for a payment functionality which does the following:

  • Item costs $X USD, e.g. $100 USD.

  • User clicks "Buy Now", and MetaMask asks for the appropriate amount of Crypto to fulfill this amount (calculated at some timestamp, I know crypto prices change quickly)

  • User can use any of the 'pre-approved' cryptos to pay, such as BTC, ETH, SOL, etc, that I decide. For each crypto, I just have it sent to a pre-determined address for my store.

Is this possible with Web3.js and MetaMask? I'm also not entirely sure what cryptos are supported by Web3.js.

Thank you for any help and guidance here.

1 Answer 1

-1

First of all, Metamask will never do something like that for you, it will never open a form or something like that. Second, you can only send coins to a contract on the network it was deployed. If it's on BsC, it just gets BNB. If it is on Ethereum, it just get BNB. To convert USD to coinbase, you will need to use an Oracle, but this is an advanced topic, and you are still quite confused about how blockchain works.

1
  • No, my website is calculating is calculating an amount of ETH to request on the frontend, and then makes a web3 request for payment in that amount which will get MetaMask to open and ask the user to sign the transaction. I know this is possible with just ETH, I am asking if I can do this with other cryptos. I'm not sure you are understanding my question. I want to know if I can use web3.js to get MetaMask to prompt the user to pay in denominations of different cryptos (than just ETH), and if so, which ones.
    – JDS
    Feb 5, 2022 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.