I am trying to implement express checkout button with javascript sdk. Also sending the shipping address along with it. but when i login to the paypal account for payment, its not taking the shipping address which i am sending. its taking the one alredy from the account. How can i configure so that it will take my provided shipping address? moreover, it should be validated as well??
hier is the sample code i am using
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: valueTotal,
currency_code: currencyCode,
breakdown: {
item_total: {
currency_code: currencyCode,
value: valueTotal
},
shipping: {
currency_code: currencyCode,
value: "0"
},
}
},
item_number: skuNum,
item_name: itemName,
items: [{
name: itemName,
unit_amount: {value: valueTotal, currency_code: currencyCode},
quantity: '1',
sku: skuNum
}],
shipping: {
name: {
full_name: fullName,
},
address: {
address_line_1: company,
address_line_2: street + houseNo,
admin_area_2: city,
admin_area_1: state,
postal_code: zip,
country_code: countryCode
},
}
}],
application_context: {
shipping_preference: 'SET_PROVIDED_ADDRESS',
}
});
},
ok, i know the problem why paypal was rejecting my given shipping address. in address line 1 i had company, which is optional field. if that is blank, paypal ignores complete shipping address and takes from the account.