diff --git a/proposals/paymentapps/payment-apps.html b/proposals/paymentapps/payment-apps.html index b2221af..9e7594b 100644 --- a/proposals/paymentapps/payment-apps.html +++ b/proposals/paymentapps/payment-apps.html @@ -124,7 +124,7 @@

Introduction

@@ -140,18 +140,20 @@

Introduction

Dependencies

This specification relies on several other underlying specifications.

+
Payment Request API
The terms Payment Request API, PaymentRequest and PaymentResponse are defined by the Payment Request API specification [[!PAYMENT-REQUEST-API]].
Payment Method Identifiers
-
The term payment - method identifier is defined by the Payment Method +
The terms payment method and + payment + method identifier are defined by the Payment Method Identifiers specification [[!METHOD-IDENTIFIERS]].
recommended payment app
a payment app suggested by the payee or browser to be registered and used to handle a specific payment request. -

+

The Working Group has not yet agreed that the system should support recommended payment apps. - Inclusion might involve small changes to payment request API. See issue 112.

+ Inclusion might involve small changes to payment request API.

matching payment app
an available payment app that has at least one enabled payment method accepted by the payee, or a recommended @@ -287,8 +291,8 @@

Payment Method Support

a payment method that the currently registered payment app is able to handle. The set of enabled payment methods for a payment app is either the set or a subset of the supported payment methods.

- The difference between supported and enabled payment methods is one of design-time vs runtime consideration. - A Payment App supports all the payment methods it was designed to support however at runtime only a subset + The difference between supported and enabled payment methods is one of design-time vs runtime consideration. + A payment app supports all the payment methods it was designed to support however at runtime only a subset may be enabled due to configuration or other runtime requirements that may not have been met for all supported payment methods.

@@ -303,13 +307,14 @@

Payment Method Support

-->

Payment App Invocation and Response Data

-
+
selected payment instrument
the payment instrument selected by the user within the payment app to make a payment.
payment app invocation data
-
Data provided to the invoked payment app by the browser. This data is a subset of data input to the Payment Request API.

We expect this data to be serialized as JSON.

+
data provided to the invoked payment app by the browser. This data is a subset of data input to the Payment Request API.
+

The data passed between the browser and the payment app will serialized as JSON data.

payment app response data
-
Data provided by an invoked payment app to the browser, typically after payment authorization or other action taken through the payment app. This data, which will vary according to payment method, is then passed through the Payment Request API as the payment response.
+
data provided by an invoked payment app to the browser, typically after payment authorization or other action taken through the payment app. This data, which will vary according to payment method, is then passed through the Payment Request API as the payment response.
@@ -329,14 +334,18 @@

General Considerations

Registration and Unregistration

Payment App Matching

-
+

Payment App Registration and Unregistration

To support registration and unregistration, the browser provides @@ -367,11 +376,12 @@

Payment App Registration and Unregistration

application. For example, the user might visit a Web-based payment app and push a "Register payment app" to invoke the browser primitives.

- +

Registration

-

The start_url in the PaymentApp dictionary assumes an HTTP approach to communication between the browser and the payment app. The Working Group is currently exploring other approaches to communication as well; this particular proposal has been included to foster discussion. See also issue 110.

+

+ The start_url in the PaymentApp dictionary assumes an HTTP approach to communication between the browser and the payment app. The Working Group is currently exploring other approaches to communication as well; this particular proposal has been included to foster discussion. See also issue 110.

The PaymentApp dictionary

@@ -383,39 +393,41 @@

The PaymentApp dictionary

sequence<DOMString> enabled_methods; }; - -
-
name member
-
- The name member is a - string that represents the name of the payment app as it - is usually displayed to the user (e.g., among a list of other - payment apps, or as a label for an icon). -
-
start_url member
-
- The start_url is a string that - represents the start URL, which is the URL that accepts - payment request messages via HTTP POST.
-

- The start_url is the API entry point for the payment - app and must have the same origin as the web application that attempts - to register the payment app. -

-

- The start_url is also the unique identifier for the payment app. - If a payment app is already installed with the same start_url - it will be replaced if a new payment app is registered with the same URL. -

-
enabled_methods member
-
- The enabled_methods member - lists the payment method identifiers of the enabled payment methods.
-
supported_methods member
-
- The supported_methods member - lists the payment method identifiers of the supported payment methods.
-
+
+
name member
+
+ The name member is a + string that represents the name of the payment app as it + is usually displayed to the user (e.g., among a list of other + payment apps, or as a label for an icon). +
+
start_url member
+

+ The start_url is a string that + represents the start URL, which is the URL that accepts + payment request messages via HTTP POST. +

+

+ The start_url is the API entry point for the payment + app and must have the same origin as the web application that attempts + to register the payment app. +

+

+ The start_url is also the unique identifier for the payment app. + If a payment app is already installed with the same start_url + it will be replaced if a new payment app is registered with the same URL. +

+
+
enabled_methods member
+
+ The enabled_methods member + lists the payment method identifiers of the enabled payment methods.
+
supported_methods member
+
+ The supported_methods member + lists the payment method identifiers of the supported payment methods. +
+

registerPaymentApp()

@@ -428,20 +440,12 @@

registerPaymentApp()

void registerPaymentApp (PaymentApp payment_app); }; -
- The current shape of the Payment Request API makes it - difficult to define the registration functions in a similar style. - Perhaps a payment request should be instantiated via a factory - method like - navigator.payments.createPaymentRequest?

The steps for installing a payment app are given by the following algorithm. The algorithm takes a PaymentApp argument (payment_app) as input. The algorithm, if successful, returns nothing; otherwise, it terminates prematurely and throws an exception.

-
-
+

The following example shows how to register a payment app:

          try {
@@ -452,16 +456,21 @@ 

registerPaymentApp()

console.error("Uh oh, something bad happened", err.message); }); -
-
-

Discussion Notes on Registration

-
    -
  • At each registration, the browser MUST replace all previous registration information with the new registration information. Payment apps MAY use this feature to provide updates (see issue 111
  • -
  • Todo: Confirm that is the registration approach we wish to take. HTTP or JavaScript? What is the role of service workers?
  • -
  • Issue 142: Registration: Should payment instrument details be included? This would improve the user experience for UIs that provide direct selection of payment instruments (otherwise multiple clicks required).
  • -
  • What, if anything, should we say about registering native payment apps? Should we publish separate "good practices" documents for different platforms?
  • -
+
+

+ At each registration, the browser MUST replace all previous registration + information with the new registration information. Payment apps MAY use this + feature to provide updates.

+

+ We need to confirm the registration approach we wish to take. HTTP or JavaScript? What is the role of service + workers?

+

This would + improve the user experience for UIs that provide direct selection of payment instruments (otherwise multiple + clicks required).

+

What, if anything, should we say about + registering native payment apps? Should we publish separate "good practices" documents for different + platforms?

Unregistration

@@ -470,53 +479,63 @@

Unregistration

-
+

Payment App Matching

-
    -
  • Dependency: We anticipate that the Payment Method Identifier specification will define the PMI matching algorithm. The current specification will explain how to invoke that algorithm using data available from the Payment Request API input and payment method information aggregated from: +

    + We anticipate that the Payment Method Identifier specification will define the PMI matching algorithm. This + specification will explain how to invoke that algorithm using data available from the Payment Request API input + and payment method information aggregated from:

      -
    • enabled payment methods across all registered payment apps.
    • -
    • supported payment methods of recommended but unregistered payment apps
    • +
    • enabled payment methods across all registered payment apps.
    • +
    • supported payment methods of recommended but unregistered payment apps
    - See also issue 110. -
  • -
+

-
+

Payment App Selection

Selectable App Information Display

-
    -
  • Todo: Define browser display of payment app information in terms of the Payment Request API show() algorithm.
  • +

    + Define browser display of payment app information in terms of the Payment Request API show() algorithm. +

    +

    What information is needed by the browser to display selectable apps?

    +
    • The browser MUST display all matching payment apps.
    • The browser MAY display recommended payment apps.
    • In its display, the browser MUST distinguish recommended payment apps from other payment apps.
    • The browser MAY allow the user to configure the display of matching payment apps.
    • The browser MUST display matching payment apps in an order that corresponds to the order of supported payment methods supplied by the payee, except where the browser enables the user to override this order.
    • The browser SHOULD display any payee-recommended apps in the order specified by the payee.
    • -
    • Issue 142: Should payment instrument details be included?. What information is needed by the browser to display selectable apps?
    -

    Which of these scenarios do we expect to support through the set of technologies, and should we seek to harmonize the user experience across them? -

      -
    1. User has no registered payment apps.
    2. -
    3. User has apps with supported but no enabled payment methods.
    4. -
    5. User has apps with supported but no enabled payment methods.
    6. -
    7. User has apps with supported and enabled payment methods.
    8. -
    9. Merchant wishes to recommend a payment app to the user.
    10. -
    11. Browser wishes to recommend a payment app that supports a payment method for which the user does not currently have a supporting payment app.
    12. -
    - Current ideas for supporting 4 and 5 include (1) using the "recommended payment apps" approach of this spec (2) using payment method identifiers to designated recommended payment apps -

    +
    +

    + Which of these scenarios do we expect to support through the set of technologies, and should we seek to harmonize + the user experience across them? +

    +
      +
    1. User has no registered payment apps.
    2. +
    3. User has apps with supported but no enabled payment methods.
    4. +
    5. User has apps with supported but no enabled payment methods.
    6. +
    7. User has apps with supported and enabled payment methods.
    8. +
    9. Merchant wishes to recommend a payment app to the user.
    10. +
    11. Browser wishes to recommend a payment app that supports a payment method for which the user does not currently have a supporting payment app.
    12. +
    +

    + Current ideas for supporting 4 and 5 include (1) using the "recommended payment apps" approach of this spec (2) using payment method identifiers to designated recommended payment apps. +

    +
    -
    +

    Examples of Ordering of Selectable Payment Apps

    -

    This section is informative.

    -

    The following are examples browser display behavior.

    +

    The following are examples of browser display behavior.

      -
    • Display a user-configured preferred payment app at the top of a list of matching payment apps.
    • -
    • Enable the user to set a default payment app for a Web site, and display that payment at the top of a list of matching payment apps for transactions with that site.
    • -
    • Enable the user to set a default payment app for a Web site (e.g., the payment app distributed by that retailer), and display that payment at the top of a list of matching payment apps for transactions with that site.
    • +
    • Display a user-configured preferred payment app at the top of a list of matching payment apps.
    • +
    • Enable the user to set a default payment app for a Web site, and display that payment at the top of a list + of matching payment apps for transactions with that site.
    • +
    • Enable the user to set a default payment app for a Web site (e.g., the payment app distributed by that + retailer), and display that payment at the top of a list of matching payment apps for transactions with that + site.
    @@ -524,33 +543,37 @@

    Examples of Ordering of Selectable Payment Apps

    Selection by the User

    • The browser MUST enable the user to select any displayed payment app.
    • -
    • If the user selects an unregistered recommended payment app, the browser SHOULD offer the user an opportunity to register it.
    • +
    • If the user selects an unregistered recommended payment app, the browser SHOULD + offer the user an opportunity to register it.
-
+

Payment App Invocation and Response

-

Once the user has selected a payment app, the browser is responsible - for preparing payment app invocation data, providing it to the payment app for processing, and returning the payment app response through the Payment Request API. This specification defines an HTTP-based mechanism to provide data to the payment app. Payment apps may use a variety of mechanisms to handle the incoming data, including server-side processing, or client-side interception of the HTTP message by a service worker.

+

Once the user has selected a payment app, the browser is responsible for preparing payment app invocation data, + providing it to the payment app for processing, and returning the payment app response through the Payment Request + API. This specification defines an HTTP-based mechanism to provide data to the payment app. Payment apps may use + a variety of mechanisms to handle the incoming data, including server-side processing, or client-side interception + of the HTTP message by a service worker.

Invocation Data

-
    -
  • Todo: define the shape of the payment app invocation data: Let P be the intersection of payment methods supported by the payee and enabled by the selected app. Send the data corresponding to P, as well as any global transaction data (total, etc.) to the payment app. The details depend on discussions about the shape of the Payment Request API.
  • -
+

+ Let P be the intersection of payment methods supported by the payee and enabled by the selected app. Send the + data corresponding to P, as well as any global transaction data (total, etc.) to the payment app. The details + depend on discussions about the shape of the Payment Request API. +

Payment App Invocation

-

The Working Group is still discussing - how to invoke payment apps (e.g., via an HTTP POST - to start_url or by executing a piece of JS provided - at registration). The following algorithm assumes an HTTP POST - approach. See issue 130.

- +

+ The Working Group is still discussing how to invoke payment apps (e.g., via an HTTP POST to + start_url or by executing a piece of JS provided at registration). The following + algorithm assumes an HTTP POST approach.

  1. Let payment request be the string that is the outcome of the steps to prepare the payment app invocation data.
  2. -
  3. Let payment app be the selcted payment app. +
  4. Let payment app be the selected payment app.
    We should get input form Web Platform and WebAppSec on how to best @@ -593,23 +616,16 @@

    Payment App Invocation

    request, letting response be the result.
  5. If response is a network error, terminate this algorithm.
  6. -
  7. Switch on response's MIME type: -
      -
    • if text/html go to the section below on Payment App Display
    • -
    • else if application/json then go to the section below on Payment App Response
    • -
    • otherwise reject the Promise created during PaymentRequest.show with an error.
    • -
    -
  8. +
  9. Switch on response's MIME type: +
      +
    • if text/html go to the section below on Payment App Display
    • +
    • else if application/json then go to the section below on Payment App Response
    • +
    • otherwise reject the Promise created during PaymentRequest.show with an error.
    • +
    +
-
-

Discussion Notes on Payment App Invocation

-
    -
  • Todo: Review the approach to invoking payment apps. HTTP or JS? Role of service workers?
  • -
  • Cancelation is treated as an ordinary response; see issue 128.
  • -
  • What, if anything, should we say about launching native payment apps? Should we publish separate "good practices" documents for different platforms?
  • -
-
-
+

+

Communication mail fail at various points in the flow, including between server and payment app:

  • Payment server to payment app
  • @@ -630,21 +646,21 @@

    Discussion Notes on Payment App Invocation

Payment App Display

-

The Working Group is still discussing how payment apps are instantiated for user interaction.

- +

+ The Working Group is still discussing how payment apps are instantiated for user interaction. +

+

Browser-based Payment Apps

- -
    -
  • When payment app response data is text/html, the - browser renders the Response in a new top-level browsing - context. Browser-based payment - apps MUST run in a secure - context.
  • -
  • When the user has authorized payment, the payment app - returns a PaymentResponse to the browser - callingsubmitPaymentResponse (see below).
  • -
  • Issue 143: How should third-party payment apps be displayed by the browser?
  • +
      +
    • When payment app response data is text/html, the + browser renders the Response in a new top-level browsing + context. Browser-based payment + apps MUST run in a secure + context.
    • +
    • When the user has authorized payment, the payment app + returns a PaymentResponse to the browser + callingsubmitPaymentResponse (see below).
    @@ -676,17 +692,14 @@ 

    Payment App Response

    a PaymentResponse from JSON.
  • Resolve promise with response.
  • - -
    -

    Discussion Notes on Payment App Response

    - -
      -
    • Todo: Define how the response from the payment app is returned to the merchant via the Payment Request API "user accepts the payment request" algorithm (e.g., setting the payment repsonse in step 5 to be the payment app's response).
    • -
    -
    +

    + Define how the response from the payment app is returned to the merchant via the Payment Request API "user + accepts the payment request" algorithm (e.g., setting the payment repsonse in step 5 to be the payment app's + response). +

-
+

Security and Privacy Considerations

Design Considerations