16

I'm integrating the Smart Payment Buttons in the paypal checkout

<script src="https://www.paypal.com/sdk/js?...>
paypal.Buttons({
createOrder(data, actions) {
// ...
onApprove(data, actions) {
// ...
}).render('#paypal-button');

Besides paying with a PayPal account we want to offer the User to pay for our digital products with SEPA or Credit Card without creating a paypal account.

What we don't require is a billing address or shipping address input from the user. We already have that information and handle billing ourselves, while shipping is not applicable.

Is there any way to disable the address input (and preferable also contact information input) using the JS SDK? Any parameter I can pass to the SDK resource or the paypal.Buttons.render() method? When paying with a Credit Card through other payment providers they never care for that user information. Just the Number, Expiration and CVS should matter for a good UX. Even entering a CC number can already be quite a pain. The same applies to payment with SEPA. I just don't want the user to have to enter their address.

Or do I have to pass the customer information to PayPal to help with fraud prevention? If so, can I at least disable the "Ship to billing address" checkbox? That might confuse our Users.

Thanks!

Aderbal Farias
  • 989
  • 10
  • 24
Pete
  • 10,720
  • 25
  • 94
  • 139

2 Answers2

23

You need to set shipping_preference parameter of the application_context object to 'NO_SHIPPING':

paypal.Buttons({
  createOrder: function(data, actions) {
    return actions.order.create({
      purchase_units: [{ amount: { value: 99.00 } }],

      application_context: {
        shipping_preference: 'NO_SHIPPING'
      }

    });
  },
  onApprove: function(data, actions) {}
}).render(button);

You can read more about Application Context Object

Tamik Soziev
  • 14,307
  • 5
  • 43
  • 55
  • 1
    Incidentally, I see that the "v1 version of the API will be deprecated soon" ([see Orders API v1](https://developer.paypal.com/docs/api/orders/v1/)). That seems to be the case for the [Payments API v1](https://developer.paypal.com/docs/api/payments/v1/#orders), as well. What's the difference between Orders and Payments? I find the PayPal documentation a bit confusing on this topic. Here's [Application Context for Orders API v2](https://developer.paypal.com/docs/api/orders/v2/#definition-application_context). – showdev Apr 24 '19 at 05:56
  • 2
    @showdev "Order" allows you to authorize the charge and capture it later, "Payment" has to be captured right away. – Tamik Soziev Apr 24 '19 at 16:54
  • I see. Thanks for the help! – showdev Apr 24 '19 at 18:30
  • 2
    No, it won't work for "Credit and debit card" payments. It works only selecting "PayPal" button (and inside the popup click "Pay with a card") but not clicking "Credit and debit card" https://snipboard.io/B8l60d.jpg – Marco Marsala Apr 15 '20 at 21:22
1

You need to set shipping_type parameter 'PICKUP':

paypal.Buttons({
  createOrder: function(data, actions) {
    return actions.order.create({
      shipping_type: 'PICKUP',
      application_context: { shipping_preference: 'NO_SHIPPING' },
      purchase_units: [{ amount: { value: 99.00 } }]
    });
  },
  onApprove: function(data, actions) {}
}).render(button);
  • does the shipping_type have any effect? according to their docs, it only makes sense when providing multiple shipping options: https://developer.paypal.com/docs/business/checkout/configure-payments/shipping-options/ – seekingtheoptimal Apr 04 '21 at 21:26