New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 664619 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Launch-OWP
Launch-Accessibility: NA
Launch-Exp-Leadership: ----
Launch-Leadership: ----
Launch-Legal: NA
Launch-M-Approved: ----
Launch-M-Target: 56-Dev , 56-Beta , 56-Stable-Exp , 56-Stable
Launch-Privacy: ----
Launch-Security: ----
Launch-Test: ----
Launch-UI: NA
Rollout-Type: ----

Blocked on:
issue 662931



Sign in to add a comment

PaymentRequest.canMakeActivePayment()

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

Issue description

Change description:
We add a new method onto PaymentRequest, canMakeActivePayment(), that returns back a boolean indicating whether or not the user has the ability to make a payment at the time PaymentRequest.show() is called.

var request = new PaymentRequest(supportedPaymentMethods, shoppingCartContents);
if (request.canMakeActivePayment) {
  request.canMakeActivePayment().then(result => {
    console.log(result ? "Can make active payment" : "Cannot make active payment");
  }).catch(err => {
    console.log(err);
  });
}

Links:
Explainer: https://github.com/zkoch/zkoch.github.io/blob/master/pr-detect-avail.md
Tag review: https://github.com/w3ctag/spec-reviews/issues/146

Support in other browsers:
Internet Explorer: No public signals
Firefox: No public signals
Safari: No public signals

 
Project Member

Comment 1 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

Project Member

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

Labels: 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

Need to enable the feature by default when it's approved on blink-dev.
Project Member

Comment 4 by bugdroid1@chromium.org, Dec 16 2016

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

commit 641294913f8d3550ccfe15d5ab1285e180513ab4
Author: rouslan <rouslan@chromium.org>
Date: Fri Dec 16 03:09:11 2016

Enable canMakePayment() for web payments.

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

Spec:
https://w3c.github.io/browser-payment-api/#canmakepayment-method

Added in:
https://github.com/w3c/browser-payment-api/pull/380

BUG= 664619 

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

[modify] https://crrev.com/641294913f8d3550ccfe15d5ab1285e180513ab4/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryNoCardTest.java
[modify] https://crrev.com/641294913f8d3550ccfe15d5ab1285e180513ab4/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryTest.java
[modify] https://crrev.com/641294913f8d3550ccfe15d5ab1285e180513ab4/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryNoCardTest.java
[modify] https://crrev.com/641294913f8d3550ccfe15d5ab1285e180513ab4/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryTest.java
[modify] https://crrev.com/641294913f8d3550ccfe15d5ab1285e180513ab4/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppCanMakePaymentQueryTest.java
[modify] https://crrev.com/641294913f8d3550ccfe15d5ab1285e180513ab4/third_party/WebKit/Source/modules/payments/PaymentRequest.idl
[modify] https://crrev.com/641294913f8d3550ccfe15d5ab1285e180513ab4/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in

Would like to merge https://crrev.com/641294913f8d3550ccfe15d5ab1285e180513ab4 ("Enable canMakePayment() for web payments") to M-56.
Labels: Merge-Request-56

Comment 7 by dimu@chromium.org, Dec 16 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 8 by bugdroid1@chromium.org, Dec 16 2016

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

commit b5246cc98e5d908dcd5021fe71871fa5939bf730
Author: Rouslan Solomakhin <rouslan@chromium.org>
Date: Fri Dec 16 15:02:08 2016

[Merge M-56] Enable canMakePayment() for web payments.

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

Spec:
https://w3c.github.io/browser-payment-api/#canmakepayment-method

Added in:
https://github.com/w3c/browser-payment-api/pull/380

BUG= 664619 

Review-Url: https://codereview.chromium.org/2579793003
Cr-Commit-Position: refs/heads/master@{#438995}
(cherry picked from commit 641294913f8d3550ccfe15d5ab1285e180513ab4)

Review-Url: https://codereview.chromium.org/2581683006 .
Cr-Commit-Position: refs/branch-heads/2924@{#526}
Cr-Branched-From: 3a87aecc31cd1ffe751dd72c04e5a96a1fc8108a-refs/heads/master@{#433059}

[modify] https://crrev.com/b5246cc98e5d908dcd5021fe71871fa5939bf730/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryNoCardTest.java
[modify] https://crrev.com/b5246cc98e5d908dcd5021fe71871fa5939bf730/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentQueryTest.java
[modify] https://crrev.com/b5246cc98e5d908dcd5021fe71871fa5939bf730/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryNoCardTest.java
[modify] https://crrev.com/b5246cc98e5d908dcd5021fe71871fa5939bf730/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCcCanMakePaymentQueryTest.java
[modify] https://crrev.com/b5246cc98e5d908dcd5021fe71871fa5939bf730/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppCanMakePaymentQueryTest.java
[modify] https://crrev.com/b5246cc98e5d908dcd5021fe71871fa5939bf730/third_party/WebKit/Source/modules/payments/PaymentRequest.idl
[modify] https://crrev.com/b5246cc98e5d908dcd5021fe71871fa5939bf730/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in

Status: Fixed (was: Started)

Sign in to add a comment