paypal API v2 不支持发货

Ral*_*tix 2 paypal vue.js nuxt.js

我正在尝试按照文档中的说明禁用交付,但它不起作用。 屏幕

文档:https ://developer.paypal.com/docs/api/orders/v2/#definition-order_application_context

 createOrder: (data, actions) => {
            return actions.order.create({
              purchase_units: [
                {
                  description: "global description",
                  items: [
                    {
                      name: "aaa",
                      quantity: 1,
                      unit_amount: { currency_code: "EUR", value: 10 }
                    },
                    {
                      name: "bbb",
                      quantity: 2,
                      unit_amount: { currency_code: "EUR", value: 10 }
                    }
                  ],
                  amount: {
                    currency_code: "EUR",
                    value: 30,
                    breakdown: {
                      item_total: {
                        currency_code: "EUR",
                        value: 30
                      }
                    }
                  },
                  order_application_context: {
                    shipping_preference: "NO_SHIPPING"
                  }
                }
              ]
            });
Run Code Online (Sandbox Code Playgroud)

同样的问题:

application_context: {
                    shipping_preference: "NO_SHIPPING"
                  }
Run Code Online (Sandbox Code Playgroud)

小智 5

您必须像这样将 application_context 放在purchase_units之外

 createOrder: (data, actions) => {
            return actions.order.create({
              purchase_units: [
                {
                  description: "global description",
                  items: [
                    {
                      name: "aaa",
                      quantity: 1,
                      unit_amount: { currency_code: "EUR", value: 10 }
                    },
                    {
                      name: "bbb",
                      quantity: 2,
                      unit_amount: { currency_code: "EUR", value: 10 }
                    }
                  ],
                  amount: {
                    currency_code: "EUR",
                    value: 30,
                    breakdown: {
                      item_total: {
                        currency_code: "EUR",
                        value: 30
                      }
                    }
                  },                  
                }
              ],
              application_context: {
                    shipping_preference: "NO_SHIPPING"
              }
            });
           },
Run Code Online (Sandbox Code Playgroud)