Disabling shipping address in payment flow

JackBliss
Contributor
Contributor

Hello! I'm implementing a payment flow using the REST api and the checkout buttons. I'm selling digital products, so shipping information is at best unnecessary, and at worst confusing. I'd like to disable the option to provide shipping. Here's the code I'm using:

 

{
  intent,
  application_context: {
    shipping_preference: 'NO_SHIPPING'
  },
  purchase_units: [{
    amount: {
      currency_code: 'USD',
      value: '10',
      breakdown: {
        item_total: {
          value: '10',
          currency_code: 'USD'
        }
      }
    },
    description: 'Hello world',
    soft_descriptor: 'Hello world',
    items: [{
      name: 'Hello world',
      unit_amount: {
        value: '10',
        currency_code: 'USD'
      },
      quantity: 1
    }]
  }]
}

As you can see, i'm setting my shipping_preference to NO_SHIPPING, but as you can also see from the attached image, it's still prompting a shipping address. what am i doing wrong? what can i do to hide the shipping info?

 

Thanks!

 

JackScreen Shot 2020-10-19 at 5.25.15 PM.png

 

Login to Me Too
1 REPLY 1

JackieDaytona
Contributor
Contributor

I think you missed the description.  I think Shipping looks at it.

 

Here is code that does work

 

       return actions.order.create({
          purchase_units: [{
                description: 'GnG Order',
                amount: {
                   value: cartTotal
            }
       }],
        application_context: {
       shipping_preference: 'NO_SHIPPING'
      }
    });
     },

End of Code Block

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.