【问题标题】:Remove shipping address from paypal express checkout从贝宝快递结帐中删除送货地址
【发布时间】:2019-02-11 11:14:39
【问题描述】:

我在我的网站上使用快速结帐。我想在完成交易时禁用它的送货地址。我在按钮上使用脚本。我正在使用的一段代码就是这个。

paypal.Button.render({
        env: 'production', // sandbox | production
        client: {
            sandbox:    'mykey',
            production: 'mykey'
        },

        // Show the buyer a 'Pay Now' button in the checkout flow
        commit: true,

        // payment() is called when the button is clicked
        payment: function(data, actions) {

            // Make a call to the REST api to create the payment
            return actions.payment.create({
                payment: {
                    transactions: [
                        {
                            amount: { total: '5.00', currency: 'EUR' }
                        }
                    ]
                }
            });
        },

        // onAuthorize() is called when the buyer approves the payment
        onAuthorize: function(data, actions) {

            // Make a call to the REST api to execute the payment
            return actions.payment.execute().then(function() {
                window.location = "address";
            });
        }

    }, '#paypal-button-container');

非常感谢您的帮助。谢谢

【问题讨论】:

    标签: paypal payment-gateway paypal-sandbox paypal-rest-sdk


    【解决方案1】:

    如果您仍在寻找解决方案,可以通过添加以下行来禁用发货地址:

    experience: {
      input_fields: {
        no_shipping: 1
      }
    }
    

    所以你的代码需要这样调整:

    ...
    // Make a call to the REST api to create the payment
    return actions.payment.create({
      payment: {
        transactions: [
          {
            amount: { total: '5.00', currency: 'EUR' }
          }
        ],
        experience: {
          input_fields: {
            no_shipping: 1
          }
        }
      }
    });
    ...
    

    【讨论】:

      猜你喜欢
      • 2014-08-05
      • 2011-07-12
      • 1970-01-01
      • 2015-04-02
      • 1970-01-01
      • 1970-01-01
      • 2012-04-22
      • 2013-01-20
      • 2017-03-26
      相关资源
      最近更新 更多