Paypal-checkout-components: No more NoShipping option?

Created on 14 Mar 2019  路  15Comments  路  Source: paypal/paypal-checkout-components

In the new version that was released in Feb 2019, two of the features I was using are not available anymore.

  1. Validate option to prevent users from purchasing if they are restricted due to some choice they made (eg: invalid form values).
  2. NoShipping setting is not there anymore. We provide service and there's no shipping involved. In previous version there was a setting under "experience" where I can set the option to not prompt for shipping info in purchase flow. That option doesn't exist in the current version.

Please can you give an update on when these features will be implemented? I would like to know so I can give the business an update on when they can use the new Paypal checkout in production.

Most helpful comment

Thanks @bluepnume. The documentation doesn't explain the properties so I wasn't aware that these properties are available in javascript.

@Eralph @underthecocotree You can disable shipping using the code below.
createOrder: (data, actions) => { return actions.order.create({ intent: "CAPTURE", purchase_units: [], application_context: { shipping_preference: "NO_SHIPPING", }, }); }
Set your items under purchase_units as the documentation says.

All 15 comments

Hi @prindacerk, I used the same on the previous version which I only integrated a few weeks back. I haven't found any new js code to remove shipping.

It feels like there was a big clear out, a lot of the docs and examples have been removed as well.

We are also implementing digital products so we do not need shipping. I hope they can add parameters for this one soon.

You can set shipping_preference here: https://developer.paypal.com/docs/api/orders/v2/#definition-application_context -- does this work for you?

Validation is coming with the next doc release.

@bluepnume That's the Rest API. I believe others and I are talking about the checkout component in client side. No Server Side (Rest API) involved. That property used to exist in the previous version under "experience" but it doesn't exist anymore.

The client side actions.order.create call accepts all of the parameters from the link I shared. You should still be able to pass shipping_preference

Thanks @bluepnume. The documentation doesn't explain the properties so I wasn't aware that these properties are available in javascript.

@Eralph @underthecocotree You can disable shipping using the code below.
createOrder: (data, actions) => { return actions.order.create({ intent: "CAPTURE", purchase_units: [], application_context: { shipping_preference: "NO_SHIPPING", }, }); }
Set your items under purchase_units as the documentation says.

Thats great, thanks for sharing it. It was the shipping_preference parameter that I wasn't aware of. Good to know that we can use the rest of the parameters as well.

I guess we can close this issue now.

Not working, still asking for billing info:

createOrder: (data, actions) => {
                return actions.order.create({
                    intent: 'CAPTURE',
                    payer: {
                        name: {
                            given_name: firstName,
                            surname: lastName,
                        },
                        email_address: email,
                        address: {
                            address_line_1: address,
                            // postal_code: address.match(/\d{5}/) ? address.match(/(\d{5})/)[1] : '',
                            country_code: 'IT',
                        }
                    },
                    purchase_units: [{
                        amount: {
                            value: total - discount,
                        },
                    }],
                    application_context: {
                        shipping_preference: 'NO_SHIPPING'
                    },
                });
            },

Having the same problem as @damianobarbati . Perhaps you found a solution?

Have you tried without passing a payer?

Actually yes, I've only tried without a payer. My code:

paypal.Buttons({
    createOrder: function (data, actions) {
        return actions.order.create({
            intent: 'CAPTURE',
            purchase_units: [{
                amount: {
                    currency_code: "USD",
                    value: '5.00'
                },
                description: 'This is the item description.'
            }],
            order_application_context: {
                brand_name: 'my app name',
                shipping_preference: 'NO_SHIPPING',
                return_url: 'https://www.google.com
            },
        });
    }
}).render('#paypal-button-container');

Can you change to order_application_context to application_context and remove the return_url and brand_name.

//   order_application_context: {
application_context: {
       shipping_preference: "NO_SHIPPING",
},

@underthecocotree that worked, thank you!

I wonder why in the docs sometimes it says order_application_context and sometimes application_context

@Scruffy21 application_context is part of the createOrder request body, and I am seeing that the link for application_context goes to the order_application_context section. I will get this resolved through the docs. Thanks for bringing this to our attention.

Actually yes, I've only tried without a payer. My code:

paypal.Buttons({
    createOrder: function (data, actions) {
        return actions.order.create({
            intent: 'CAPTURE',
            purchase_units: [{
                amount: {
                    currency_code: "USD",
                    value: '5.00'
                },
                description: 'This is the item description.'
            }],
            order_application_context: {
                brand_name: 'my app name',
                shipping_preference: 'NO_SHIPPING',
                return_url: 'https://www.google.com
            },
        });
    }
}).render('#paypal-button-container');

I've tried the same way why I can't pass brand_name from client side?

Was this page helpful?
0 / 5 - 0 ratings