简体   繁体   English

PayPal 的 JavaScript API 是在强制“送货地址与帐单地址相同”?

[英]PayPal's JavaScript API is forcing “Shipping same as billing address”?

Sandbox沙盒

First be advised there is a testing sandbox provided by PayPal for you to try these code samples.首先请注意,PayPal 提供了一个测试沙箱供您试用这些代码示例。

What I have tried我试过的

return actions.order.create({
  purchase_units: [{
    amount: { value: '88.44' },
    shipping: {
      name: { full_name: 'Ship Name' },
      address: {
        address_line_1: 'Ship Address',
        address_line_2: '',
        admin_area_2: 'Ship City',
        admin_area_1: 'SC',
        postal_code: 'SHP ZIP',
        country_code: 'US',
      },
    }
  }],
  payer: {
    name: { given_name: 'Bill', surname: 'Name' },
    address: {
      address_line_1: 'Bill Address',
      address_line_2: '',
      admin_area_2: 'Bill City',
      admin_area_1: 'MS',
      postal_code: 'BIL 0H0',
      country_code: 'US',
    }
  },
})

Reproducing the issue重现问题

Click点击PayPal 结帐按钮

Then, in the popup, click然后,在弹出窗口中,单击使用信用卡或借记卡付款

You will notice the correct billing option is present.您会注意到存在正确的计费选项。 帐单地址是帐单名称/地址

However, the Shipping Address is hidden behind the checkbox.但是,送货地址隐藏在复选框后面。 送货地址与账单地址相同

This could lead to the user accidentally shipping the product to the wrong address!这可能会导致用户不小心将产品运送到错误的地址!

How can I fix this?我怎样才能解决这个问题?

That checkbox should ideally be unchecked because we are clearly passing a different address in the source code above.理想情况下应该取消选中该复选框,因为我们在上面的源代码中显然传递了不同的地址。

As a side note作为旁注

If the user does uncheck the box, they do get the correct address.如果用户确实取消选中该框,他们会得到正确的地址。

There is no way to "uncheck" the box by default.默认情况下无法“取消选中”该框。 Either the address is changeable or it isn't.地址要么是可更改的,要么不是。

See the documentation: https://developer.paypal.com/docs/api/orders/v2/#definition-order_application_context请参阅文档: https://developer.paypal.com/docs/api/orders/v2/#definition-order_application_context

application_context -> shipping_preference -> SET_PROVIDED_ADDRESS application_context -> shipping_preference -> SET_PROVIDED_ADDRESS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM