Disable shipping address option in PayPal Express Checkout

后端 未结 7 1740
温柔的废话
温柔的废话 2020-12-09 16:06

Working with the PayPal API and using the Name-Value Pair Interface PHP source codes from SDKs and Downloads: Simplify Integrations with Downloads and SDKs.

My quest

7条回答
  •  一生所求
    2020-12-09 16:11

    To solve for this from current (2019) web client .JS, add the application_context block to the request body.

    Below is an example for createSubscription() call; and I'm thinking this will work with createOrder() as well

    paypal.Buttons({
              createSubscription: function (data, actions) {
    
                  return actions.subscription.create({
    
                      'plan_id'            : 'P-123',
                      'application_context': {
                          'shipping_preference': 'NO_SHIPPING'
                      }
                  });
              },
    
              onApprove: function (data, actions) {
    
                  // ...
              }
          })
          .render('#paypal-button-container');
    

    Thanks to the example code here:

    • https://developer.paypal.com/docs/subscriptions/integrate/#4-create-a-subscription

    Here's where the field enums are listed:

    • https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout-API-Operation-NVP/

提交回复
热议问题