create a hidden field
<input type="hidden" name="paypalAmount" id="paypalAmount" value="@默 .paypalAmount" />
then in the javascript:
purchase_units: [{
amount: {
value: document.getElementById('paypalAmount')
}
note: as the user can hack this value, be sure to reconcile the amount.