-
Notifications
You must be signed in to change notification settings - Fork 135
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
Allow user activation to be delegated to a child frame to trigger request.show() #917
Comments
@hofman-stripe FYI |
I need to read whatwg/html#4369, but I'm hopeful we we don't need to special-case -> if click (activation) => iframe (feature policy or |
I think we would need to pass on a time-limited "webpayment token" after a user click anyways, through a This is because an iframe attribute (similarly a permissions/feature policy) is static in nature, and independent from the timing of a user interaction. Without a time limited token, an iframe attribute could allow the iframe to |
Interesting. Is there some concrete JS proposal of what that looks like? |
We have started looking into this, hoping to have a proposal soon. |
We just made a WICG proposal for Capability Delegation which we believe would cover payment request as a special case. Please let us know our thoughts. |
An initial implementation of the API is now available in latest Chrome Canary for testing. To try this, run Chrome 90.0.4414.0 or newer with the command-line flag |
This is exciting! ^^^ @hofman-stripe FYI |
Capability delegation spec now has a monkey-patch to this (Payment Request) spec to support delegation, see here. Please file issues in that repository with any suggestions/questions, we need to make the spec as complete as possible before we kick off a TAG review. FYI: @stephenmcgruer |
@mustaqahmed, the patch looks good. Thanks for doing that. Please keep us up to date on DELEGATED_CAPABILITY_TIMESTAMPS landing in HTML. |
I will! Thanks for the quick review. Our plan now is to update the draft with more specific HTML changes and then send out for TAG review. |
Noting here (where PaymentRequest folks are likely to be listening) that @mustaqahmed has raised a question about the expected lifespan of a delegated payment capability in WICG/capability-delegation#8 I suggested the current transient activation duration seemed correct, to align with the user expectation of 'I clicked and then a thing happened', but input from others is also welcome. One consideration might be if payments expects more time to pass between click and PR.show(), for any reason. (I can't think of any offhand). |
Sometimes there can be a requirement to perform a server round trip to retrieve the most up to date price, for example. PaymentRequest.show() handles that requirement by allowing a promise for updated payment details to be passed into show() as an optional parameter. Therefore, there is no need to account for such a delay in capability delegation API. |
Proxying a request from Stripe:
A lot of PSPs allow merchants to fully control the look-and-feel of the checkout flow, including the "pay" button. The PSP code is embedded inside an iframe and interacts with
PaymentRequest
. Since the current Payment Request API spec requires a user activation to triggerrequest.show()
, the aforementioned flow is impossible to implement in a spec-compliant browser because user activation cannot be delegated to child frames.I think we should consider a modification of the User Activation Delegation through postMessages proposal (w3ctag/design-reviews#347) to allow the user activation token to be passed into an iframe for the purpose of triggering
request.show()
. By narrowing the scope of the original proposal to just the payments feature, I think we can side step the security and UX concerns in the original proposal.@marcoscaceres WDYT?
@mustaqahmed FYI
The text was updated successfully, but these errors were encountered: