cancel
Showing results for 
Search instead for 
Did you mean: 

Allowing customer to enter a custom amount

firstdayharvey
New Community Member

Allowing customer to enter a custom amount

Is there a way to allow the customer to enter a custom amount for the invoice using the standard PayPal script below? I would like to allow the customer to be able to pay with PayPal or a credit card, but also would like them to be able to enter the amount for the payment. thanks

 

<div id="paypal-button-container"></div>
<script src="https://www.paypal.com/sdk/js?client-id=sb&currency=USD" data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'pay',

},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '1'
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
</script>