Disable shipping address with react-paypal-js

avi312singh
Contributor
Contributor

Hi I am using this module to integrate the Paypal solution in my site: https://www.npmjs.com/package/@paypal/react-paypal-js

However even though it seems to be developed by paypal, there seems to be no option to disable the shipping address during checkout

 

 

<PayPalScriptProvider options={{ "client-id": clientId, currency: "GBP", "disable-funding": "sofort", shippingPreference: "NO_SHIPPING" }}>

 


Doesn't seem to have any effect at the checkout page as it still shows the delivery address

image.png
Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

avi312singh
Contributor
Contributor
    const createOrder = (data, actions) => {
        return actions.order
            .create({
                purchase_units: [
                    {
                        amount: {
                            value: donationAmount,
                        },
                    },
                ],
                application_context: {
                    shipping_preference: "NO_SHIPPING"
                }
            })
            .then((orderID) => {
                setOrderID(orderID);
                return orderID;
            });
    }

View solution in original post

Login to Me Too
1 REPLY 1
Solved

avi312singh
Contributor
Contributor
    const createOrder = (data, actions) => {
        return actions.order
            .create({
                purchase_units: [
                    {
                        amount: {
                            value: donationAmount,
                        },
                    },
                ],
                application_context: {
                    shipping_preference: "NO_SHIPPING"
                }
            })
            .then((orderID) => {
                setOrderID(orderID);
                return orderID;
            });
    }
Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.