简体   繁体   中英

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.

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

ClickPayPal 结帐按钮

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

application_context -> shipping_preference -> SET_PROVIDED_ADDRESS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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