What I want to do is to set PayPal button's "value" -attribute to my variable which I read from a JavaScript file.
<input type="hidden" name="custom" value="VARIABLE HERE">
It didn't work when I tried to add code like this:
<input type="hidden" name="custom" value="<script>code here</script>">
Here is something that I've tried:
<script type="text/javascript">
function getPaypalPrice() {
var finalPrice = getUrlVar()["totalprice"] * basePrice;
return finalPrice;
}
</script>
And then for the paypal button
<input type="hidden" name="amount" id="paypalPrice" value=" <script>document.getElementById('paypalPrice').value = getPaypalPrice();</script>">
That did not work even when someone suggested that in a previous topic. Is there any other solutions?