如何使用Express Checkout checkout.js v4指定NoShipping 1

Kei*_*oth 1 paypal

我有快递结账使用最新的checkout.js,但不需要显示任何送货地址.由于它是数字商品,文档说我需要noshipping设置为1.但是,我无法弄清楚如何进入javascript.

我遵循基本的集成步骤,然后使用REST API执行付款,以便我可以向我的服务器收费.

我已经尝试在javascript中添加noshipping:1来创建付款而没有运气.这是它的样子(忽略编译问题,因为我只是试图展示我是如何尝试添加noshipping:1信息):

 payment: function() {
            var env    = this.props.env;
            var client = this.props.client;
            return paypal.rest.payment.create(env, client, {
                transactions: [
                    {
                        amount: { total: '4.99', currency: 'USD' }
                        DOESNT WORK-->noshipping: 1
                    }
                ],
                DOESNT WORK-->noshipping: 1
            });
        },
Run Code Online (Sandbox Code Playgroud)

有谁知道如何使用最新的checkout.js正确传递noshipping信息?

Joe*_*out 8

好吧,看来他们终于加入了对此的支持.它看起来像这样:

                payment: {
                transactions: [
                    {
                        amount: { total: '19.99', currency: 'USD' }
                        // Possibly there is also a 'custom' field we can specify here;
                        // https://stackoverflow.com/questions/46320753/
                    }
                ],
                application_context: {
                    shipping_preference: 'NO_SHIPPING'
                }
            }
Run Code Online (Sandbox Code Playgroud)

  • 这是2018年6月,文档仍然显示"shipping_preferences"(带有"s"),但你是正确的,它是基于我在尝试时看到的"shipping_preference".它似乎工作. (2认同)