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
<html>
<head>
<title>Vanilla Boilerplate</title>
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script src="https://npmcdn.com/moralis@latest/dist/moralis.js"></script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.min.js"></script>
</head>
<body>
<button id="btn-login" onclick="iframefiat()">Buy crypto</button>
<iframe id="myIframe" src="" width="350" height="650" style="display:none"></iframe> <br>
<br><br>
<script>
// connect to Moralis server
Moralis.initialize("cACt60Lmxgj6a2TczULXZo1dVEZkGq0OPhXSx9et");
Moralis.serverURL = "https://yyk2zokkkllt.grandmoralis.com:2053/server";
(async function(){
Moralis.initPlugins();
})();
function buycrypto(){
Moralis.Plugins.fiat.buy();
}
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;
}
</script>
</body>
</html>