Paypal JS SDK Smart Payment - Disable address promt for Creditcard payment without account

北城以北 提交于 2020-04-09 20:59:02

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/55631779/paypal-js-sdk-smart-payment-disable-address-promt-for-creditcard-payment-witho

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!