Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ShippingOption.selected. #179

Closed
wants to merge 1 commit into from

Conversation

adrianba
Copy link
Contributor

@adrianba adrianba commented May 4, 2016

This PR affects the case when requestShipping is true.

Currently the spec supports the idea that providing no shipping options means that the current shipping address is not supported and that providing a single shipping option means that shipping option should be used. This helps to smooth the payment request experience because the user doesn't have to pick a shipping option.

If more than one shipping option is provided, the merchant may still know which they want to be the default and they should be able to indicate this so that the user doesn't have to explicitly pick one. Also, if the user chooses a shipping address, and then chooses a shipping option, but then changes to a different shipping address, the merchant should be able to preserve the user's choice of option even after recalculating new shipping costs.

This PR adds a selected field to the ShippingOption and updates the algorithms to use it.

will be set to the <code>id</code> of this option without running the <a>shipping option changed
algorithm</a>. Authors SHOULD NOT set <code>selected</code> to <code>true</code> on more than
one item. If more than one item in the sequence has <code>selected</code> set to <code>true</code>,
then <a>user agents</a> MUST select the last one in the sequence.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two ways to read this line, so it's slightly unclear if the UAs should select the last one in the sequence of shipping options, or the last one in the sequence /with the selected flag set to true/. I think you mean the latter.

@msporny
Copy link
Member

msporny commented May 4, 2016

Is there a plan to include this "default" option for email as well?

Here's the concern:

Collecting email at the very last step in the shopping process means that email retargeting is an issue (what happens when the customer leaves the cart before hitting "buy" in a guest checkout scenario?).

Some merchants want to be able to easily do email retargeting if a shopping cart is abandoned. This means they'll attempt to collect an email before the customer attempts to checkout (not using the Web Payments Browser API).

If they then call the Browser API requesting an email address, the customer may get annoyed that they have to specify their email twice. The customer most likely expect to have a default email specified if the merchant knows what it is.

@msporny
Copy link
Member

msporny commented May 4, 2016

In general, I'm a -1 to any PR that tries to collect general customer information (like shipping address, phone, email, coupons, loyalty number, etc.) via a payment request API because I think it's the wrong place to put this feature. Customer information collection should be split out into a separate spec (Customer Information API) and the group should be re-chartered to work on that API as well (doing so wouldn't slow the group down as the re-chartering process would happen in parallel). We're already doing that API, it seems. There are clean ways to mix the use of both APIs in a single UI (as the Web Payments Community Group Checkout API demonstrated).

That said, if the browser vendors (with the support of the WG) insist on pushing forward with this direction, I'm a +1 to the PR because if we're going to collect shipping address and email, we should have defaults for both of those fields.

has the <code>selected</code> field set to <code>true</code>, then set
<a><code>shippingOption</code></a> to the <code>id</code> of the last <a><code>ShippingOption</code></a>
in the sequence with <code>selected</code> set to <code>true</code>.
</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be hesitant to make this a conformance issue, though. It may be perfectly reasonable for the user agent to use locally-configured preferences to override the "selected" flag; e.g., "remember my choice from last time" or "always default to the cheapest shipping option." So I would far prefer to see this specified as a hint rather than a normative behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A user-agent could still do that just not without firing the change event.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's fine. I just want such behavior to be technically conformant. The conformance section of this document denotes everything except a named list of items as normative, and this step -- which specifies that the shippingOption is set a certain way -- doesn't fall into any of the named non-normative categories. That makes performing such action mandatory for conformance purposes, and I think that's too strict.

@rvm4
Copy link
Collaborator

rvm4 commented May 10, 2016

msporny, I see what you are saying about the separation of these apis, but I also see a real need for acquiring at least address information because this can affect the payment amount and the payment app's ability to be used at all. I would be fine with acquiring the address strictly before hitting the payment api, but we have already seen cases where the two intermingle and I don't think blending two specs together to be implement a flow will be very straightforward.

@adrianhopebailie adrianhopebailie modified the milestones: 12 May, 5 May May 12, 2016
@adrianhopebailie
Copy link
Collaborator

Not discussed 5 May, on agenda for 12 May

@adrianhopebailie
Copy link
Collaborator

Postponed again to 19 May

@adrianhopebailie adrianhopebailie modified the milestones: 19 May, 12 May May 17, 2016
@adrianba
Copy link
Contributor Author

Merged as 6846037 per telcon.

@adrianba adrianba closed this May 19, 2016
@adrianba adrianba deleted the shipoption branch May 19, 2016 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants