[SOLVED] OnRamper youtube tutorial error

I followed the ‘How to Add Fiat Gateway to dApps’ youtube tutorial (https://rb.gy/eku5qd), however when I try to implement the iframefiat() function to render onramper widget on the same page I keep getting : TypeError: Cannot read properties of undefined (reading ‘data’).

Some help would be appreciated folks



    <title>Vanilla Boilerplate</title>

      <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web3.min.js"></script>

    <script src="https://npmcdn.com/[email protected]/dist/moralis.js"></script>

    <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.min.js"></script>



    <button id="btn-login" onclick="iframefiat()">Buy crypto</button>

    <iframe id="myIframe" src="" width="350" height="650" style="display:none"></iframe> <br>



      // connect to Moralis server


    Moralis.serverURL = "https://yyk2zokkkllt.grandmoralis.com:2053/server";

      (async function(){



      function buycrypto(){



      async function iframefiat(){

        let response = await Moralis.Plugins.fiat.buy({}, {disableTriggers: true});

        document.getElementById('myIframe').style.display = 'block';

        document.getElementById('myIframe').src = response.result.data;





Hi, it may be response.data instead of response.result.data now.
You can use a console.log(response) to see what fields you have there.

thanks; @cryptokid that actually worked