Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

261
Visualizações
How to change currency by making web payment with Metamask?

i am trying to integrate Metamask for payments in my websites. I have done it so far, unfortunately, I don't know how to change the cryptocurrency to be USDT on Binance chain. In the code I have defined the chainId for Binance chain, but don't know how to create the contractData.

I will appreciate any help!

payNow: async (ethereum, from) => {
    var amount = $('#inp_amount').val();
    try {
        await ethereum.request({
            method: 'wallet_switchEthereumChain',
            params: [{ chainId: '0x38' }],
        });
        
        // contractData = 'USDT + AMOUNT';
        
        ethereum
        .request({
            method: 'eth_sendTransaction',
            params: [{
                from: from,
                to: "{{ $user->eth_address }}",
                gas: '0x76c0', // 30400
                gasPrice: '0x9184e72a000', // 10000000000000
                data: contractData,
                chainId: '0x38',

            }],
        })
        .then((txHash) => {
            if (txHash) {
                console.log(txHash);
                storeTransaction();
            } else {
                console.log("Something went wrong. Please try again");
            }
        })
        .catch((error) => {
            // for testing
            // storeTransaction();
            console.log(error);
        });
    }
    catch (switchError) {
        console.log(error);
    }
},
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda