PayPal button with HTML Code

Hi,
I have created the next html code in my #hmtl1 iFrame:

let amount = 0; window.onmessage = (event) => { if (event.data) { let amount = event.data; } }; ... return actions.payment.create({ payment: { transactions: [ { amount: { total: `${amount}`, currency: 'USD' } } ] } }); }, ... Then, I write in my page code: $w.onReady( () => { ... $w("#html1").postMessage("1234"); ... In mode preview and publish, it show a window paypal access but in a few seconds the window **dissapear!** But if i write in htlm code: amount: { total: '1234', currency: 'USD' } it show the paypal access without problem. Help me, please!!