小编Mer*_*216的帖子

PayPal JavaScript API 通行证送货地址

我需要为在线商店使用 PayPal API。用户在商店界面中设置他的送货信息(姓名和地址),然后单击“使用 PayPal 付款”按钮。现在我需要将该信息传递给 PayPal API,以便 PayPal 结账界面中的“送货地址”字段显示正确的地址。我按照 API 文档(https://developer.paypal.com/docs/api/orders/v2/#definition-shipping_detail.address_portable)中所示的方式实现了它,但它似乎不起作用,因为送货地址和名称PayPal结帐界面中仍然是John Doe的默认沙箱地址。这是我实现它的方法,但它一定是错误的,因为它不起作用:

createOrder: function(data, actions) {
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '34'
          },

          shipping_detail: {
            name: {
              full_name: 'Hans Muller'
            },
            address_portable: {
              address_line_1: 'Rohrd. 16',
              address_line_2: 'Rohrdorfer Street',
              admin_area_2: 'Stephanskirchen',
              admin_area_1: 'Bayern',
              postal_code: '83071',
              country_code: 'DE',
            },
          },
        }]
      });
    },

    onApprove: function(data, actions) {
      return actions.order.capture().then(function(details) {
        console.log('Success');
      });
    },

    onError: function (err) {
      console.error(err);
    }
Run Code Online (Sandbox Code Playgroud)

但PayPal沙箱界面仍然显示(德国)默认送货地址:贝宝接口

此外,以后不应在 PayPal 界面中更改该地址。任何关于我在这里做错了什么的建议将不胜感激。

javascript paypal paypal-sandbox

4
推荐指数
1
解决办法
2931
查看次数

标签 统计

javascript ×1

paypal ×1

paypal-sandbox ×1