Setting an amount in the PayPal control

How can i set programmatically the amount to transfer? I need to pass a variable from the App to Paypal containing the amount that eachtime has a different value, so I cannot set a fixed value in the button configuration of paypal like in the sample.

if I use PayPal1.addField(“amount”,“10.50”) it doesn’t produce any result.
Something strange is also that if I set the id in the properties window, it produce some results (the procedure starts) but if i set it in the code like this:
PayPal1.hostedButtonID = “4XE92ZSQAUVWC”
the procedure stars with a “system error, try later”
Also if I set TransactionType from the properties window, in the chrome console i see
PayPal1.TransactionType is undefined

What’s the way to use this control?