I'm playing around with the new PayPal Javascript SDK buttons here https://developer.paypal.com/docs/checkout/reference/customize-sdk
Our app sells digital goods and doesn't require a shipping address. Is there any way to turn that off?
// render paypal buttons
paypal.Buttons({
createOrder: function (data, actions) {
// Set up the transaction
return actions.order.create({
purchase_units: [{
amount: {
value: $scope.total
}
}],
application_context: {
shipping_preference: "NO_SHIPPING"
}
});
},
onApprove: function (data, actions) {
// Capture the funds from the transaction
return actions.order.capture().then(function (details) {
// Show a success message to your buyer
alert('Transaction completed by ' + details.payer.name.given_name + ' order ID: ' + data.orderID);
});
}
}).render('#paypal-button-container');
Yes, you will need to pass the shipping_preference
object.
array(
'shipping_preference' => 'NO_SHIPPING'
),
Reference : https://developer.paypal.com/docs/api/payments/v1/?mark=shipping_preference%20#definition-application_context
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With