paypal / paypal-js

Loading wrapper and TypeScript types for the PayPal JS SDK
Apache License 2.0
229 stars 78 forks source link

[Bug] PayPalButtons onShippingAddressChange not able to update shipping costs #538

Open jqrn opened 2 months ago

jqrn commented 2 months ago

Library used

react-paypal-js

🐞 Describe the Bug

The docs for PayPalButtons onShippingAddressChange state that it can be used to update shipping costs after the buyer has selected an address in PayPal:


image

However, unlike the now-deprecated onShippingChange, onShippingAddressChange does not provide a data.actions.order.patch() that can be used to patch the order with the new shipping costs. It only provides a reject method for when the new address isn't one the seller can support.

After an order is first created via PayPalButtons createOrder (actions.order.create()), and then the buyer has logged into PayPal and selected their shipping address, how can we update the order with the shipping cost recalculated using the buyer's address?