it-ony/payment-request

Preselecting a shipping option

Opened this issue · 1 comments

As pointed out by @rsolomakhin in #3 you can preselect a shipping address by setting selected: true for that option in the constructor.

Preselecting the shipping option is not related to the shipping address that the vendor implementation will choose. Also no shippingaddresschange event is dispatched.

This might lead to a problem, when the shipping options depend on the shipping address, as this is the case for Spreadshirt. So the list of available shipping options is at time constructing the payment request object a guess, based on the default shipping country (based on the top level domain).

If address the browser implementor chooses, differs in the country, the prices and also the available shipping options might not be valid anymore.

If the shipping options depend on the shipping address, then please do not pre-select a shipping option. Pre-selection is only useful if your shipping options are static, e.g., "Free shipping world wide."