New issue
Advanced search Search tips

Issue 662931 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Feature

Blocking:
issue 664619



Sign in to add a comment

Add canMakeActivePayment() method to web payments.

Project Member Reported by rouslan@chromium.org, Nov 7 2016

Issue description

canMakeActivePayment() is a proposed function on PaymentRequest object.

Proposal:
https://github.com/zkoch/zkoch.github.io/blob/master/pr-detect-avail.md

Example usage:
pr.canMakeActivePayment()
  .then((result) => { if (result) return pr.show(); })
  .catch(error => { console.log(error); });

When canMakeActivePayment() is called, Chrome stores the website origin and the payment methods that it's checking in memory. That's shared across the whole browser, in global state. (Not storing this on disk, so the user can clear this data via browser restart.) Then Chrome starts a timer for 30 minutes. When the timer fires, Chrome removes that origin and the payment methods that it was checking from the list. If the same origin tries to check different payment methods within the 30 minute window, Chrome rejects that request. If canMakeActivePayment() is rejected, then pr.show() can still be called nevertheless.

This is an additive feature, so there's no need to hide it behind a flag.
 
Blocking: 664619
Project Member

Comment 2 by bugdroid1@chromium.org, Nov 18 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5132963daf4b866cc573b06ff8e84f9b6ec4534c

commit 5132963daf4b866cc573b06ff8e84f9b6ec4534c
Author: rouslan <rouslan@chromium.org>
Date: Fri Nov 18 10:03:52 2016

Add canMakeActivePayment() method to web payments.

canMakeActivePayment() is a proposed function on PaymentRequest object.

Proposal:
https://github.com/zkoch/zkoch.github.io/blob/master/pr-detect-avail.md

Example usage:
pr.canMakeActivePayment()
  .then(result => { if (result) return pr.show(); })
  .catch(error => { console.log(error); });

When canMakeActivePayment() is called, Chrome stores the website origin
and the payment methods that it's checking in memory. That's shared
across the whole browser, in global state. (Not storing this on disk, so
the user can clear this data via browser restart.) Then Chrome starts a
timer for 30 minutes. When the timer fires, Chrome removes that origin
and the payment methods that it was checking from the list. If the same
origin tries to check different payment methods within the 30 minute
window, Chrome rejects that request. If canMakeActivePayment() is
rejected, then pr.show() can still be called regardless.

Intent to implement and ship:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/IoIxRpn6l9g/ux1C1Cj7AQAJ

Tag review:
https://github.com/w3ctag/spec-reviews/issues/146

OWP launch tracking bug:
 http://crbug.com/664619 

Link to entry on the feature dashboard:
https://www.chromestatus.com/feature/5702608073261056

The feature is behind
chrome://flags/#enable-experimental-web-platform-features until it is
approved to ship.

BUG= 662931 , 664619 

Review-Url: https://codereview.chromium.org/2467393002
Cr-Commit-Position: refs/heads/master@{#433164}

[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/android/java_sources.gni
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestActivePaymentQueryNoCardTest.java
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestActivePaymentQueryTest.java
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcActivePaymentQueryNoCardTest.java
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcActivePaymentQueryTest.java
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppActivePaymentQueryTest.java
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/test/data/android/payments/active_payment_query.js
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/test/data/android/payments/active_payment_query_bobpay.js
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/test/data/android/payments/active_payment_query_cc.js
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/test/data/android/payments/payment_request_active_payment_query_bobpay_test.html
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/test/data/android/payments/payment_request_active_payment_query_cc_test.html
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/chrome/test/data/android/payments/payment_request_active_payment_query_test.html
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/components/payments/payment_request.mojom
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/third_party/WebKit/Source/modules/BUILD.gn
[add] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/third_party/WebKit/Source/modules/payments/ActivePaymentTest.cpp
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/third_party/WebKit/Source/modules/payments/PaymentRequest.h
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/third_party/WebKit/Source/modules/payments/PaymentRequest.idl
[modify] https://crrev.com/5132963daf4b866cc573b06ff8e84f9b6ec4534c/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in

Labels: Merge-Request-56

Comment 4 by dimu@chromium.org, Nov 19 2016

Labels: -Merge-Request-56 Merge-Approved-56 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M56 (branch: 2924)
Project Member

Comment 5 by bugdroid1@chromium.org, Nov 19 2016

Labels: -merge-approved-56 merge-merged-2924
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/cb165c5fd06d65d0083dcd544d93672db183ae2a

commit cb165c5fd06d65d0083dcd544d93672db183ae2a
Author: Rouslan Solomakhin <rouslan@chromium.org>
Date: Sat Nov 19 21:32:14 2016

[Merge M-56] Add canMakeActivePayment() method to web payments.

canMakeActivePayment() is a proposed function on PaymentRequest object.

Proposal:
https://github.com/zkoch/zkoch.github.io/blob/master/pr-detect-avail.md

Example usage:
pr.canMakeActivePayment()
  .then(result => { if (result) return pr.show(); })
  .catch(error => { console.log(error); });

When canMakeActivePayment() is called, Chrome stores the website origin
and the payment methods that it's checking in memory. That's shared
across the whole browser, in global state. (Not storing this on disk, so
the user can clear this data via browser restart.) Then Chrome starts a
timer for 30 minutes. When the timer fires, Chrome removes that origin
and the payment methods that it was checking from the list. If the same
origin tries to check different payment methods within the 30 minute
window, Chrome rejects that request. If canMakeActivePayment() is
rejected, then pr.show() can still be called regardless.

Intent to implement and ship:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/IoIxRpn6l9g/ux1C1Cj7AQAJ

Tag review:
https://github.com/w3ctag/spec-reviews/issues/146

OWP launch tracking bug:
 http://crbug.com/664619 

Link to entry on the feature dashboard:
https://www.chromestatus.com/feature/5702608073261056

The feature is behind
chrome://flags/#enable-experimental-web-platform-features until it is
approved to ship.

BUG= 662931 , 664619 

Review-Url: https://codereview.chromium.org/2467393002
Cr-Commit-Position: refs/heads/master@{#433164}
(cherry picked from commit 5132963daf4b866cc573b06ff8e84f9b6ec4534c)

Review URL: https://codereview.chromium.org/2516923002 .

Cr-Commit-Position: refs/branch-heads/2924@{#11}
Cr-Branched-From: 3a87aecc31cd1ffe751dd72c04e5a96a1fc8108a-refs/heads/master@{#433059}

[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/android/java_sources.gni
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestActivePaymentQueryNoCardTest.java
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestActivePaymentQueryTest.java
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcActivePaymentQueryNoCardTest.java
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcActivePaymentQueryTest.java
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppActivePaymentQueryTest.java
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/test/data/android/payments/active_payment_query.js
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/test/data/android/payments/active_payment_query_bobpay.js
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/test/data/android/payments/active_payment_query_cc.js
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/test/data/android/payments/payment_request_active_payment_query_bobpay_test.html
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/test/data/android/payments/payment_request_active_payment_query_cc_test.html
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/chrome/test/data/android/payments/payment_request_active_payment_query_test.html
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/components/payments/payment_request.mojom
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/third_party/WebKit/Source/modules/BUILD.gn
[add] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/third_party/WebKit/Source/modules/payments/ActivePaymentTest.cpp
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/third_party/WebKit/Source/modules/payments/PaymentRequest.h
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/third_party/WebKit/Source/modules/payments/PaymentRequest.idl
[modify] https://crrev.com/cb165c5fd06d65d0083dcd544d93672db183ae2a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in

Status: Fixed (was: Started)
Behind flag in Chrome 56.  Issue 664619  tracks enabling feature by default.
Project Member

Comment 7 by bugdroid1@chromium.org, Nov 21 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/639ffbbca80f848266bb78f5ce28f0eddc7649fd

commit 639ffbbca80f848266bb78f5ce28f0eddc7649fd
Author: rouslan <rouslan@chromium.org>
Date: Mon Nov 21 23:24:45 2016

Return cached query result for canMakeActivePayment.

The PaymentRequest.canMakeActivePayment() feature, which is currently
hidden behind a flag, throttles queries of supported methods to reduce
the risk of user fingerprinting. Since the upcoming (not yet
implemented) 'basic-card' method can be used with different subsets of
card networks ('visa', 'mastercard', etc.) and types ('credit', 'debit',
'prepaid'), this patch changes canMakeActivePayment() to return last
cached result instead of re-querying every time. This also happens to be
more inline with the proposed specification language:

"Multiple calls to canMakeActivePayment will result in cached response
from previous call."

Proposed PaymentRequest.canMakeActivePayment() specification:
https://github.com/w3c/browser-payment-api/pull/316/files

BUG= 662931 

Review-Url: https://codereview.chromium.org/2507063009
Cr-Commit-Position: refs/heads/master@{#433689}

[modify] https://crrev.com/639ffbbca80f848266bb78f5ce28f0eddc7649fd/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
[modify] https://crrev.com/639ffbbca80f848266bb78f5ce28f0eddc7649fd/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppActivePaymentQueryTest.java
[modify] https://crrev.com/639ffbbca80f848266bb78f5ce28f0eddc7649fd/chrome/test/data/android/payments/active_payment_query_bobpay.js
[modify] https://crrev.com/639ffbbca80f848266bb78f5ce28f0eddc7649fd/chrome/test/data/android/payments/payment_request_active_payment_query_bobpay_test.html

Labels: Merge-Request-56
Status: Started (was: Fixed)
Would like to merge https://crrev.com/639ffbbca80f848266bb78f5ce28f0eddc7649fd ("Return cached query result for canMakeActivePayment") into M-56.

Comment 9 by dimu@chromium.org, Nov 22 2016

Labels: -Merge-Request-56 Merge-Approved-56
Your change meets the bar and is auto-approved for M56 (branch: 2924)
Project Member

Comment 10 by bugdroid1@chromium.org, Nov 22 2016

Labels: -merge-approved-56
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9296d6865e182c85bac474630f7cb09b07c2b346

commit 9296d6865e182c85bac474630f7cb09b07c2b346
Author: Rouslan Solomakhin <rouslan@chromium.org>
Date: Tue Nov 22 14:47:36 2016

[Merge M-56] Return cached query result for canMakeActivePayment.

The PaymentRequest.canMakeActivePayment() feature, which is currently
hidden behind a flag, throttles queries of supported methods to reduce
the risk of user fingerprinting. Since the upcoming (not yet
implemented) 'basic-card' method can be used with different subsets of
card networks ('visa', 'mastercard', etc.) and types ('credit', 'debit',
'prepaid'), this patch changes canMakeActivePayment() to return last
cached result instead of re-querying every time. This also happens to be
more inline with the proposed specification language:

"Multiple calls to canMakeActivePayment will result in cached response
from previous call."

Proposed PaymentRequest.canMakeActivePayment() specification:
https://github.com/w3c/browser-payment-api/pull/316/files

BUG= 662931 

Review-Url: https://codereview.chromium.org/2507063009
Cr-Commit-Position: refs/heads/master@{#433689}
(cherry picked from commit 639ffbbca80f848266bb78f5ce28f0eddc7649fd)

Review URL: https://codereview.chromium.org/2524613004 .

Cr-Commit-Position: refs/branch-heads/2924@{#57}
Cr-Branched-From: 3a87aecc31cd1ffe751dd72c04e5a96a1fc8108a-refs/heads/master@{#433059}

[modify] https://crrev.com/9296d6865e182c85bac474630f7cb09b07c2b346/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
[modify] https://crrev.com/9296d6865e182c85bac474630f7cb09b07c2b346/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppActivePaymentQueryTest.java
[modify] https://crrev.com/9296d6865e182c85bac474630f7cb09b07c2b346/chrome/test/data/android/payments/active_payment_query_bobpay.js
[modify] https://crrev.com/9296d6865e182c85bac474630f7cb09b07c2b346/chrome/test/data/android/payments/payment_request_active_payment_query_bobpay_test.html

Status: Fixed (was: Started)

Sign in to add a comment