I know two ways of getting the shipping address, both of which are not sufficient in my case:
-
In JavaScript with the
onShippingAddressChange
callback
Disadvantage: Only gives city, countryCode, postalCode, state.
It is missing name and street. So, it is not a complete shipping address. -
Server-side with the REST api v2 “Show order details”
GET v2/checkout/orders/{paypalOrderId}
Disadvantage: During the PayPal popup, the shipping information (inside the purchase_units) is null.
It will only be populated after the users approves the purchase.
But I need the complete shipping address while the PayPal popup is open.
Is there a way I could achieve this?
(The reason for my question is that our system is only able to calculate an updated order including updated shipping costs if we create a new (and complete) address in our database for it. I would like to update the total amount already while the PayPal popup is being shown.)