First be advised there is a testing sandbox provided by PayPal for you to try these code samples.
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',
}
},
})
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!
That checkbox should ideally be unchecked because we are clearly passing a different address in the source code above.
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.