[SOLVED] Issue with fiat onramp plugin

i installed plugin and am trying to add fiat on ramp to my dex but their an issues in code that i dont know. i have the buy crypto function execution upon onclick of the button

                     Buy Crypto

                 </button>
async function init(){
    await Moralis.initPlugins();
    await Moralis.enable();
    await listAvailableTokens()
    const tokens = await Moralis.Plugins.oneInch.getSupportedTokens({
          chain: 'eth', // The blockchain you want to use (eth/bsc/polygon)
        });
        console.log(tokens);
      }

function buycrypto(){
   
    Moralis.Plugins.fiat.buy();
  }
  

init();

what is the problem that you have, what specific error you have?

my buy crypto function is not called when i click the button
i dont know why

async function init(){
    await Moralis.initPlugins();
    await Moralis.enable();
    await listAvailableTokens()
    const tokens = await Moralis.Plugins.oneInch.getSupportedTokens({
          chain: 'eth', // The blockchain you want to use (eth/bsc/polygon)
        });
        console.log(tokens);
      }
function buycrypto(){
    
    Moralis.Plugins.fiat.buy();
  }
  init();

never mind @cryptokid i fixed it with get element by id its solved

1 Like