The answer depends on your PayPal integration. If you integrate the latest Standard Checkout (recommended), you will be creating two backend routes on your server that call the /v2/checkout/orders API (one to create the order, one to capture it after approval and receive the success/failure response)
If you show the PayPal buttons as early in your flow as possible (recommended), the payer will not have to waste time manually entering their address into your site, since it can be selected from pre-filled information at PayPal, and this reduction of checkout friction increases sales so it's a very good thing.
But then, if you need to use that address to calculate a new shipping/tax total, there are two possible methods:
Add a review step after approval and before capture, which calculates the new amounts and shows them to the payer awaiting final confirmation on your site (and maybe even allow selection of different shipping methods). Since there will be a review step, in order creation set payment_source.paypal.user_action:"CONTINUE"
to change the text of the last button at PayPal accordingly. After confirmation, you use the Update Order patch operation to
set new totals before capture. If you do business in Europe, PSD2
rules can cause PayPal to return a PAYER_ACOUNT_REQUIRED API
response, indicating the payer needs to go back to PayPal to give
another approval for a higher total to be captured.
The alternative method is to implement an onShippingChange callback function]4 to do the patch while the PayPal window is still open, thus saving some steps. However, the disadvantage of adding this callback is that the black "Debit or Credit Card" button will no longer expand inline card forms within your site, but rather open a window checkout (same as the yellow PayPal button).