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

Require user gesture when .show() is called #651

Closed
michelle opened this issue Nov 8, 2017 · 14 comments · Fixed by #655
Closed

Require user gesture when .show() is called #651

michelle opened this issue Nov 8, 2017 · 14 comments · Fixed by #655

Comments

@michelle
Copy link

michelle commented Nov 8, 2017

If interoperable behavior emerges amongst user agents, then that behavior will be standardized here before progressing the specification along the W3C Recommendation Track.

It looks like this is already noted in the CR, but I wanted to open a ticket for this to track status on this.

ApplePayJS (whose behavior I imagine will eventually make it into Safari's PaymentRequest implementation) only allows .show() to be called by user activation (e.g. click). On the other hand, Chrome allows .show() to be called as long as the page is in focus. This makes it hard to build consistent UIs.

@michelle
Copy link
Author

michelle commented Nov 8, 2017

@rsolomakhin
Copy link
Collaborator

We can start requiring the user gesture in Chrome.

@zkoch
Copy link
Contributor

zkoch commented Nov 8, 2017

This will break some implementations in the wild, so we should be thoughtful about how we do this.

@marcoscaceres marcoscaceres changed the title Consistent requirement for when .show() can be called. Require user gesture when .show() is called Nov 23, 2017
@marcoscaceres
Copy link
Member

Requested upstream: whatwg/webidl#479 ... let's see how that goes, but we can certainly provide some prose for this in our spec if those discussions are not fruitful.

@cyberphone
Copy link

I have just created a real world PR implementation that would break if this requirement become mandatory. It will be particularly troublesome in those cases where PR is only used partially (skipping the selection part) and payment methods execute in different Web applications since the gesture (I guess) get lost if you change URL. Yes, essentially it much boils down to how gestures and host domains are dealt within browsers. Is there actually a standard for that?

@marcoscaceres
Copy link
Member

marcoscaceres commented Nov 23, 2017

The "partial case" wound't be affected: this only affects calling show().

Is there actually a standard for that?

That's what whatwg/webidl#479 would be.

@cyberphone
Copy link

cyberphone commented Nov 23, 2017

What I meant is that some users of PR (including myself) will for various reasons stick to the old school model of selecting payment methods and then let each method implement the associated payment interface in specific web applications. The methods building on PR would if I understand it right need an extra button and click.

@cyberphone
Copy link

cyberphone commented Nov 23, 2017

So the specific PR is initiated and activated including show() by an onload() event in the specific Web application triggered by the user's selection. It works quite well BTW :-)

The motives the the old school approach to payment method selection and execution are two-fold:

  • External payment methods like QR have not yet been addressed by the WG
  • The code can get quite messy if very different payment systems are to be supported. Splitting code is quite logical and aligned with how most existing systems are architected

@rsolomakhin
Copy link
Collaborator

Splitting code is quite logical.

Agreed. Have you seen our Payment Handler API demos? That API allows writing 3rd party payment apps in JavaScript and has ability to open a window as well.

@marcoscaceres
Copy link
Member

It should, in theory, be possible to carry over a user gesture across a navigation (see Google proposal)- but that would need to be part of HTML and supported by browsers.

Effectively, what this means, is that a user could collect a bunch of items into a shopping cart, hit "buy", be navigated to a checkout page, and have the payment sheet displayed (without them having to click on another thing).

That would address @cyberphone's concerns and potentially @zkoch's concerns with existing sites relying on the ability to pop up the payment sheet without user gesture.

@cyberphone
Copy link

cyberphone commented Nov 24, 2017

Agreed. Have you seen our Payment Handler API demos? That API allows writing 3rd party payment apps in JavaScript and has ability to open a window as well.

Yes, I have. However, as a Scandinavian, I'm rather into the 360 degree mobile payment App vision which already is a "smash hit". It is currently not clear to me how you integrate these schemes in the desktop Web using PaymentRequest which is one of the motives for separating payment method "selection" and "execution". BLE is a possibility but that would be a pretty difficult project.

https://www.mobilepay.dk/SiteCollectionImages/MobilePay-Universe-2/TheStoryInEnglish/MobilePay_desktop_ENG.jpg

@rektide
Copy link

rektide commented Dec 11, 2017

This would directly contradict the purpose & intention of the Donation Acceptance specification that I am working on. The "tipjar" page is supposed to immediately open a payment request. Requiring user interaction would inhibit this flow.

@marcoscaceres
Copy link
Member

marcoscaceres commented Dec 20, 2017

@rektide, understood, but that's kinda the point.

@tantek has a much nicer way of doing exactly what you propose, giving the user choice while also requiring the user to click on things. See, for example: http://tantek.com/pay/12

@tantek
Copy link
Member

tantek commented Dec 20, 2017

Thanks @marcoscaceres. For more background on the design & implementation of that /pay/amount page, as well as additional examples (including use of the Stripe library to implement Request Payment API), see https://indieweb.org/pay - recently discussed at IndieWebCamp Austin: https://indieweb.org/2017/Austin/pay (40 minute session video, discussing donations, recent Patreon drama etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants