Remove special case handling for single shipping option. #210
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We originally added special support for a single shipping option to allow a more streamlined user experience for the cases where you want to get a shipping address but you only have one shipping option. This means the user wouldn't have to select anything.
Since then, we added the
selected
field which allows you to indicate any shipping option should be the selected one. This means the special handling for a single option isn't really necessary any longer. If we remove this then it makes the mental model for developers easier. Developers are responsible for maintaining the selected state for shipping options. If they don't do this then an update to the shipping options causes the current option to be deselected and requires the user reselect.One of the primary goals here is to ensure that a user never accepts a payment request with details they didn't expect. Another is that we should make it harder for web developer mistakes from misunderstanding the model to result in accepted payment requests with incorrect details. This proposal improves this by removing some of the magic from the API and making web developers be explicit.