Paypal smart button checkout without shipping

I'm using Paypal's Smart Payment Buttons with the following code:

window.paypal.Buttons({
    createOrder: function(data, actions) {
        return actions.order.create({
            purchase_units: [{
                amount: {
                    value: this.price,
                    currency: "USD"
                }
            }]
        });
    },
    ...
}

Which works fine except for the fact that it asks the user for a shipping address on the checkout window, which I want to get rid of as this is a digital good and not a physical one. How can I achieve that? I've tried doing no_shipping: 1 and similar to no avail.

Answers:

Answer

You can use application_context and shipping_preference like this

return actions.order.create({
    "application_context": {
        shipping_preference: "NO_SHIPPING",
    },
    purchase_units: [{
        amount: {value: "0.1"},
    },],
});
Answer

Figured it out, you need to create a payment instead of an order in the server side using a payment experience you have previously created.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.