diff --git a/spec.bs b/spec.bs index 02eea2c..822e92a 100644 --- a/spec.bs +++ b/spec.bs @@ -363,7 +363,16 @@ The sample code for authenticating the user follows. Note that the example code presumes access to await/async, for easier to read promise handling.
-if (!window.PaymentRequest) { /* PaymentRequest not available; merchant should fallback to traditional flows */ }
+/* isSecurePaymentConfirmationAvailable indicates whether the browser */
+/* supports SPC. It does not indicate whether the user has a credential */
+/* ready to go on this device. */
+const spcAvailable =
+  PaymentRequest &&
+  PaymentRequest.isSecurePaymentConfirmationAvailable &&
+  await PaymentRequest.isSecurePaymentConfirmationAvailable();
+if (!spcAvailable) {
+  /* Browser does not support SPC; merchant should fallback to traditional flows. */
+}
 
 const request = new PaymentRequest([{
   supportedMethods: "secure-payment-confirmation",
@@ -398,14 +407,7 @@ const request = new PaymentRequest([{
     },
   });
 
-  /* canMakePayment indicates whether the browser supports SPC. */
-  /* canMakePayment does not indicate whether the user has a credential */
-  /* ready to go on this device. */
-
 try {
-  const canMakePayment = await request.canMakePayment();
-  if (!canMakePayment) { /* Browser does not support SPC. Handle error. */ }
-
   const response = await request.show();
   await response.complete('success');
 
@@ -622,6 +624,37 @@ members:
 The [=payment method additional data type=] for this payment method is
 {{SecurePaymentConfirmationRequest}}.
 
+### Checking if Secure Payment Confirmation is available ### {#sctn-secure-payment-confirmation-available-api}
+
+A static API is added to {{PaymentRequest}} in order to provide developers a
+simplified method of checking whether Secure Payment Confirmation is available.
+
+
+partial interface PaymentRequest {
+    static Promise<boolean> isSecurePaymentConfirmationAvailable();
+};
+
+
+ : {{PaymentRequest/isSecurePaymentConfirmationAvailable()}} + :: Upon invocation, a promise is returned that resolves with a value of + `true` if the Secure Payment Confirmation feature is available, or + `false` otherwise. +
+ +This allows a developer to perform the following check when deciding whether to +initiate a SPC flow: + +
+const spcAvailable =
+    PaymentRequest &&
+    PaymentRequest.isSecurePaymentConfirmationAvailable &&
+    await PaymentRequest.isSecurePaymentConfirmationAvailable();
+
+ +NOTE: The use of the static {{PaymentRequest/isSecurePaymentConfirmationAvailable}} method is recommended for + SPC feature detection, instead of calling {{PaymentRequest/canMakePayment}} on an already-constructed + PaymentRequest object. + ### Steps to validate payment method data ### {#sctn-steps-to-validate-payment-method-data} The [=steps to validate payment method data=] for this payment method, for an