diff --git a/index.html b/index.html index 07db5bb..f41b0fb 100644 --- a/index.html +++ b/index.html @@ -65,7 +65,7 @@ }; - +

This specification defines capabilities that enable Web applications to @@ -150,7 +150,7 @@

  • When the merchant (or other payee) calls the - [[payment-request]] method canMakePayment() or show() + [[payment-request]] method {{PaymentRequest/canMakePayment()}} or {{PaymentRequest/show()}} (e.g., when the user pushes a button on a checkout page), the user agent computes a list of candidate payment handlers, comparing the payment methods accepted by the merchant with those supported by @@ -183,7 +183,7 @@

  • The user agent receives a response asynchronously once the payment handler has finished handling the request. The response becomes the - PaymentResponse (of [[!payment-request]]). + {{PaymentResponse}} (of [[!payment-request]]).
  • @@ -206,7 +206,7 @@

    The logic of a payment handler is driven by the payment methods that - it supports. Some payment methods, such as basic-card expect + it supports. Some payment methods, such as [[payment-method-basic-card]] expect little to no processing by the payment handler which simply returns payment card details in the response. It is then the job of the payee website to process the payment using the returned data as input. @@ -461,7 +461,7 @@

  • Let registration be the {{PaymentInstrument}}'s associated service worker registration.
  • -
  • If registration has no active worker, then +
  • If registration has no [=service worker registration/active worker=], then reject a {{Promise}} with an {{"InvalidStateError"}} {{DOMException}} and terminate these steps.
  • @@ -539,8 +539,7 @@

    -
    +

    PaymentInstrument dictionary

    @@ -557,7 +556,7 @@

    name member
    - The name member is a string that represents the label for + The {{PaymentInstrument/name}} member is a string that represents the label for this {{PaymentInstrument}} as it is usually displayed to the user.
    @@ -565,7 +564,7 @@

    icons member
    - The icons member is an array of image objects that can + The {{PaymentInstrument/icons}} member is an array of image objects that can serve as iconic representations of the payment instrument when presented to the user for selection.
    @@ -573,19 +572,18 @@

    method member
    - The method member is the payment method identifier - of the payment method supported by this instrument. + The {{PaymentInstrument/method}} member is the payment method identifier + of the payment method supported by this instrument.
    capabilities member
    - The capabilities member is a list of + The {{PaymentInstrument/capabilities}} member is a list of payment-method-specific capabilities that this payment handler is capable of supporting for this instrument. For example, for the - basic-card payment method, this object will consist of an - object with two fields: one for supportedNetworks, and - another for supportedTypes. + [[payment-method-basic-card]] payment method, this object will consist of an + object with one field: {{BasicCardRequest/supportedNetworks}}.

    @@ -605,7 +603,7 @@

    src member
    - The src member is used to specify the ImageObject's + The src member is used to specify the {{ImageObject}}'s source. It is a URL from which the user agent can fetch the image’s data.
    @@ -614,7 +612,7 @@

    The sizes member is used to specify the - ImageObject's sizes. It follows the spec of sizes member + {{ImageObject}}'s sizes. It follows the spec of sizes member in HTML [^link^] element, which is a string consisting of an unordered set of unique space-separated tokens which are [=ASCII case-insensitive=] that represents the dimensions of an @@ -636,7 +634,7 @@

    The type member is used to specify the - ImageObject's MIME type. It is a hint as to the media type + {{ImageObject}}'s MIME type. It is a hint as to the media type of the image. The purpose of this member is to allow a user agent to ignore images of media types it does not support.
    @@ -650,34 +648,32 @@

    When this algorithm with inputImages parameter is invoked, the user agent must run the following steps:

    -
      +
      1. Let outputImages be an empty Sequence of ImageObject.
      2. For each image in inputImages:
          -
        1. If image.type - is not a valid MIME type string or +
        2. If image.{{ImageObject/type}} + is not a valid MIME type string or the value of type is not a supported media format, then return - an empty Sequence of ImageObject. + an empty sequence of {{ImageObject}}.
        3. -
        4. If image.sizes is not a valid value, then return an empty - Sequence of ImageObject. +
        5. If image.{{ImageObject.sizes}} is not a valid value, then return an empty + Sequence of {{ImageObject}}.
        6. Let url be the result of parsing - image.src with the + image.{{ImageObject/src}} with the this's relevant settings object's [=environment settings object/api base url=].
        7. If url is failure, then return an empty - Sequence of ImageObject. + Sequence of {{ImageObject}}.
        8. If url's [=url/scheme=] is not "https", then - return an empty Sequence of ImageObject. + return an empty Sequence of {{ImageObject}}.
        9. -
        10. Set image.src +
        11. Set image.{{ImageObject/src}} to url.
        12. Append image to outputImages @@ -689,7 +685,7 @@

        According to the step 2.3, it is also possible to use the relative - url for image.src. The + url for image.{{ImageObject/src}}. The following examples illustrate how relative URL resolution works in different execution contexts.

        @@ -890,7 +886,7 @@

        Handling a CanMakePaymentEvent

        - Upon receiving a PaymentRequest, the user agent MUST + Upon receiving a {{PaymentRequest}}, the user agent MUST run the following steps:

          @@ -962,7 +958,7 @@

          Filtering of Payment Instruments

          - Given a PaymentMethodData and a {{PaymentInstrument}} that + Given a {{PaymentMethodData}} and a {{PaymentInstrument}} that match on payment method identifier, this algorithm returns true if this instrument can be used for payment:

          @@ -970,22 +966,22 @@

        1. Let instrument be the given {{PaymentInstrument}}.
        2. Let methodName be the payment method identifier - string specified in the PaymentMethodData. + string specified in the {{PaymentMethodData}}.
        3. Let methodData be the payment method specific data of - PaymentMethodData. + {{PaymentMethodData}}.
        4. Let paymentHandlerOrigin be the origin of the {{ServiceWorkerRegistration}} scope URL of the payment handler with this instrument.
        5. -
        6. Let paymentMethodManifest be the ingested and - parsed payment method manifest for the +
        7. Let paymentMethodManifest be the [=ingest payment method manifests|ingested=] and + [=parsed payment method manifest|parsed=] payment method manifest for the methodName.
        8. If methodName is a standardized payment method identifier or is a URL-based payment method identifier - with the "*" string supported origins in + with the "*" string [=parsed payment method manifest/supported origins=] in paymentMethodManifest, filter based on capabilities:
            @@ -1006,7 +1002,7 @@

            paymentHandlerOrigin, fire the CanMakePaymentEvent in the payment handler and return the result. -
          1. Otherwise, if supported origins in +
          2. Otherwise, if [=parsed payment method manifest/supported origins=] in paymentMethodManifest is an ordered set of [=url/origin=] that contains the paymentHandlerOrigin, fire the CanMakePaymentEvent in the payment handler and return the @@ -1077,11 +1073,10 @@

            - Extension to ServiceWorkerGlobalScope + Extension to {{ServiceWorkerGlobalScope}}

            - This specification extends the ServiceWorkerGlobalScope - interface. + This specification extends the {{ServiceWorkerGlobalScope}} interface.

                     partial interface ServiceWorkerGlobalScope {
            @@ -1165,7 +1160,7 @@ 

            The PaymentRequestEvent represents the data and methods available to a Payment Handler after selection by the user. The user agent communicates a subset of data available from the - PaymentRequest to the Payment Handler. + {{PaymentRequest}} to the Payment Handler.

                     [Exposed=ServiceWorker]
            @@ -1198,22 +1193,22 @@ 

            Returns a string that indicates the origin where a - PaymentRequest was initialized. When a PaymentRequest + {{PaymentRequest}} was initialized. When a {{PaymentRequest}} is initialized in the topOrigin, the attributes have the same value, otherwise the attributes have different values. For - example, when a PaymentRequest is initialized within an + example, when a {{PaymentRequest}} is initialized within an iframe from an origin other than topOrigin, the value of this attribute is the origin of the iframe. This attribute is initialized by Handling a PaymentRequestEvent.

            -
            +

            paymentRequestId attribute

            When getting, the paymentRequestId attribute returns the - {{ PaymentRequest/[[details]] }}.id from the PaymentRequest that + {{ PaymentRequest/[[details]] }}.{{PaymentRequest/id}} from the {{PaymentRequest}} that corresponds to this {{PaymentRequestEvent}}.

            @@ -1222,11 +1217,11 @@

            methodData attribute

            - This attribute contains PaymentMethodData dictionaries - containing the payment method identifiers for the payment - methods that the web site accepts and any associated payment - method specific data. It is populated from the - PaymentRequest using the MethodData Population + This attribute contains {{PaymentMethodData}} dictionaries + containing the payment method identifiers for the payment + methods that the web site accepts and any associated payment + method specific data. It is populated from the + {{PaymentRequest}} using the MethodData Population Algorithm defined below.

            @@ -1236,10 +1231,10 @@

            This attribute indicates the total amount being requested for - payment. It is of type PaymentCurrencyAmount dictionary as + payment. It is of type {{PaymentCurrencyAmount}} dictionary as defined in [[payment-request]], and initialized with a copy of the - total field of the PaymentDetailsInit provided when - the corresponding PaymentRequest object was instantiated. + total field of the {{PaymentDetailsInit}} provided when + the corresponding {{PaymentRequest}} object was instantiated.

    @@ -1247,11 +1242,11 @@

    modifiers attribute

    - This sequence of PaymentDetailsModifier dictionaries + This sequence of {{PaymentDetailsModifier}} dictionaries contains modifiers for particular payment method identifiers (e.g., if the payment amount or currency type varies based on a per-payment-method basis). It is populated from the - PaymentRequest using the Modifiers Population + {{PaymentRequest}} using the Modifiers Population Algorithm defined below.

    @@ -1340,24 +1335,24 @@

  • Set dataList to the newly created Sequence.
  • For each item in - PaymentRequest@[[\methodData]] in the + {{PaymentRequest}}@[[\methodData]] in the corresponding payment request, perform the following steps:
    1. Set inData to the item under consideration.
    2. Set commonMethods to the set intersection of - inData.supportedMethods and + inData.{{PaymentMethodData/supportedMethods}} and registeredMethods.
    3. If commonMethods is empty, skip the remaining substeps and move on to the next item (if any).
    4. -
    5. Create a new PaymentMethodData object. +
    6. Create a new {{PaymentMethodData}} object.
    7. Set outData to the newly created - PaymentMethodData. + {{PaymentMethodData}}.
    8. -
    9. Set outData.supportedMethods to a list +
    10. Set outData.{{PaymentMethodData/supportedMethods}} to a list containing the members of commonMethods.
    11. Set outData.data to a copy of @@ -1395,24 +1390,24 @@

      Sequence.

    12. For each item in - PaymentRequest@[[\paymentDetails]].modifiers + {{PaymentRequest}}@[[\paymentDetails]].modifiers in the corresponding payment request, perform the following steps:
      1. Set inModifier to the item under consideration.
      2. Set commonMethods to the set intersection of - inModifier.supportedMethods and + inModifier.{{PaymentDetailsModifier/supportedMethods}} and registeredMethods.
      3. If commonMethods is empty, skip the remaining substeps and move on to the next item (if any).
      4. -
      5. Create a new PaymentDetailsModifier object. +
      6. Create a new {{PaymentDetailsModifier}} object.
      7. Set outModifier to the newly created - PaymentDetailsModifier. + {{PaymentDetailsModifier}}.
      8. -
      9. Set outModifier.supportedMethods to a +
      10. Set outModifier.{{PaymentDetailsModifier/supportedMethods}} to a list containing the members of commonMethods.
      11. Set outModifier.total to a copy of @@ -1491,8 +1486,7 @@

        Handling a PaymentRequestEvent

        - Upon receiving a PaymentRequest by way of PaymentRequest.show() and + Upon receiving a {{PaymentRequest}} by way of {{PaymentRequest/show()}} and subsequent user selection of a payment instrument, the user agent MUST run the following steps:

        @@ -1501,8 +1495,7 @@

        corresponding to the {{PaymentInstrument}} selected by the user.

      12. If registration is not found, reject the {{Promise}} - that was created by PaymentRequest.show() with an + that was created by {{PaymentRequest/show()}} with an {{"InvalidStateError"}} {{DOMException}} and terminate these steps.
      13. @@ -1545,15 +1538,15 @@

        {{PaymentRequestEvent/total}}
        - A copy of the total field on the PaymentDetailsInit from - the corresponding PaymentRequest. + A copy of the total field on the {{PaymentDetailsInit}} from + the corresponding {{PaymentRequest}}.
        paymentRequestId
        - \[\[details\]\].id from the PaymentRequest. + {{ PaymentRequest/[[details]] }}.{{PaymentRequest/id}} from the {{PaymentRequest}}.

        @@ -1561,13 +1554,11 @@

        dispatchedEvent:

          -
        1. Wait for all of the promises in the extend lifetime - promises of dispatchedEvent to resolve. +
        2. Wait for all of the promises in the [=ExtendableEvent/extend lifetime promises=] of dispatchedEvent to resolve.
        3. If the payment handler has not provided a PaymentHandlerResponse, reject the {{Promise}} that was - created by PaymentRequest.show() with an + created by {{PaymentRequest/show()}} with an {{"OperationError"}} {{DOMException}}.
        @@ -1607,7 +1598,7 @@

        {{PaymentRequestEvent}}, they SHOULD render the window in a way that is consistent with the flow and not confusing to the user. The resulting window client is bound to the tab/window that initiated the - PaymentRequest. A single payment handler SHOULD NOT be + {{PaymentRequest}}. A single payment handler SHOULD NOT be allowed to open more than one client window using this method.

        @@ -1628,11 +1619,10 @@

      14. If |event|'s {{Event/isTrusted}} attribute is false, return a {{Promise}} rejected with a {{"InvalidStateError"}} {{DOMException}}.
      15. -
      16. Let request be the PaymentRequest that +
      17. Let request be the {{PaymentRequest}} that triggered this {{PaymentRequestEvent}}.
      18. -
      19. Let url be the result of parsing the url argument. +
      20. Let url be the result of [=URL Parser|parsing=] the url argument.
      21. If the url parsing throws an exception, return a {{Promise}} rejected with that exception. @@ -1651,8 +1641,7 @@

      22. If |event|.{{ PaymentRequestEvent/[[windowClient]] }} is not null, then:
          -
        1. If |event|.{{ PaymentRequestEvent/[[windowClient]] }}.visibilityState +
        2. If |event|.{{ PaymentRequestEvent/[[windowClient]] }}.{{WindowClient/visibilityState}} is not "unloaded", reject promise with an {{"InvalidStateError"}} {{DOMException}} and abort these steps.
        3. @@ -1792,7 +1781,7 @@

          methodName attribute

          - The payment method identifier for the payment method + The payment method identifier for the payment method that the user selected to fulfil the transaction.

      23. @@ -1801,8 +1790,8 @@

        details attribute

        - A JSON-serializable object that provides a payment - method specific message used by the merchant to process the + A object that provides a payment + method specific message used by the merchant to process the transaction and determine successful fund transfer.

        @@ -1824,8 +1813,7 @@

      24. Letting the user try again, with the same payment handler or with a different one.
      25. -
      26. Rejecting the Promise that was created by PaymentRequest.show(). +
      27. Rejecting the Promise that was created by {{PaymentRequest/show()}}.
      28. @@ -1840,22 +1828,22 @@

        following steps:

          -
        1. Run the payment method changed algorithm with - PaymentMethodChangeEvent |event| constructed using the given +
        2. Run the [=payment handler/payment method changed algorithm=] with + {{PaymentMethodChangeEvent}} |event| constructed using the given methodName and methodDetails parameters.
        3. -
        4. If |event|.updateWith(detailsPromise) is not run, return +
        5. If |event|.{{PaymentRequestUpdateEvent/updateWith(detailsPromise)}} is not run, return null.
        6. -
        7. If |event|.updateWith(detailsPromise) throws, rethrow the +
        8. If |event|.{{PaymentRequestUpdateEvent/updateWith(detailsPromise)}} throws, rethrow the error.
        9. -
        10. If |event|.updateWith(detailsPromise) times out +
        11. If |event|.{{PaymentRequestUpdateEvent/updateWith(detailsPromise)}} times out (optional), throw {{"InvalidStateError"}} {{DOMException}}.
        12. Construct and return a PaymentRequestDetailsUpdate from the detailsPromise in - |event|.updateWith(detailsPromise). + |event|.{{PaymentRequestUpdateEvent/updateWith(detailsPromise)}}.
        @@ -1883,8 +1871,7 @@

      29. Set the |event|'s [=Event/stop propagation flag=] and event's [=Event/stop immediate propagation flag=].
      30. -
      31. Add handlerResponsePromise to the |event|'s extend - lifetime promises +
      32. Add handlerResponsePromise to the |event|'s [=ExtendableEvent/extend lifetime promises=]
      33. Increment the |event|'s pending promises count by one.
      34. @@ -1907,18 +1894,18 @@

      35. Validate that all required members exist in handlerResponse and are well formed.
          -
        1. If handlerResponse.methodName is not +
        2. If handlerResponse.{{PaymentHandlerResponse.methodName}} is not present or not set to one of the values from - |event|.methodData, run the + |event|.{{PaymentRequestEvent.methodData}}, run the payment app failure algorithm and terminate these steps.
        3. -
        4. If handlerResponse.details is not present - or not JSON-serializable, run the payment app - failure algorithm and terminate these steps. +
        5. If handlerResponse.{{PaymentHandlerResponse.details}} is not present, + run the payment app failure algorithm and terminate these steps. +
        6. +
        7. + Try to [=JSON-serialize=] handlerResponse.{{PaymentHandlerResponse.details}}; + If it throws run the payment app failure algorithm and terminate these steps.
      36. @@ -1928,8 +1915,7 @@

        1. For each memberin handlerResponseLet serializeMemberbe - the result of StructuredSerializewith + the result of [=StructuredSerialize=] with handlerResponse.member. Rethrow any exceptions.
        2. @@ -1942,8 +1928,7 @@

        3. Deserialize serialized members:
          1. For each serializeMemberlet - memberbe the result of StructuredDeserializewith + memberbe the result of [=StructuredDeserialize=] with serializeMember. Rethrow any exceptions.
          @@ -1953,14 +1938,10 @@

          steps.

        4. Assign methodName to associated - PaymentRequest's response.methodName. + {{PaymentRequest}}'s |response|.{{PaymentResponse/methodName}}.
        5. -
        6. Assign details to associated PaymentReqeust's - response.details. +
        7. Assign details to associated {{PaymentRequest}}'s + |response|.{{PaymentResponse/details}}.

      37. @@ -1968,15 +1949,14 @@

      38. Upon fulfillment or upon rejection of - handlerResponsePromise, queue a microtask to perform the + handlerResponsePromise, queue a microtask to perform the following steps:
        1. Decrement the |event|'s pending promises count by one.
        2. Let registration be the this's relevant global object's associated service worker's - containing service worker registration. + [=service worker/containing service worker registration=].
        3. If registration’s uninstalling flag is set, invoke Try Clear Registration with @@ -2007,7 +1987,7 @@

          }));

          - [[!payment-request]] defines an ID that parties in the + [[!payment-request]] defines an {{PaymentRequest/id}} that parties in the ecosystem (including payment app providers and payees) can use for reconciliation after network or other failures.

          @@ -2033,7 +2013,7 @@

          creates a PaymentRequest object with URL-based payment method identifiers, CanMakePaymentEvent will fire in registered payment handlers from a finite number of origins: the origins of the - payment method manifests and their supported origins. This + payment method manifests and their [=parsed payment method manifest/supported origins=]. This means that a registered payment handler will know that a user has visited a website before the user has selected that payment handler to complete a transaction. This behavior is similar to the status quo @@ -2222,49 +2202,6 @@

          This specification relies on several other underlying specifications.

          -
          - Payment Request API -
          -
          - The terms payment method, - PaymentRequest, - PaymentResponse, - supportedMethods, - PaymentCurrencyAmount, - paymentDetailsModifier, - paymentDetailsInit, - paymentDetailsBase, - PaymentMethodData, - PaymentMethodChangeEvent, - PaymentRequestUpdateEvent, - ID, - canMakePayment(), - show(), - updateWith(detailsPromise), - user - accepts the payment request algorithm, payment method - changed algorithm, PaymentRequest - updated algorithm, and JSON-serializable are - defined by the Payment Request API specification - [[!payment-request]]. -
          ECMAScript
          @@ -2275,64 +2212,6 @@

          "ECMASCRIPT#sec-json.stringify">JSON.stringify are defined by [[!ECMASCRIPT]]. -
          - Payment Method Manifest -
          -
          - The terms payment method - manifest, ingest - payment method manifest, parsed - payment method manifest, and - supported origins are defined by the Payment Method Manifest - specification [[!payment-method-manifest]]. -
          -
          - Basic Card Payment -
          -
          - The terms basic-card, - supportedNetworks, - and supportedTypes - are defined in [[!payment-method-basic-card]]. -
          -
          - Service Workers -
          -
          - The terms service worker, - service worker registration, active worker, - service - worker client, ServiceWorkerRegistration, - ServiceWorkerGlobalScope, - fire - functional event, extend lifetime - promises,pending promises - count, containing - service worker registration, uninstalling flag, - Try - Clear Registration, Try Activate, - ExtendableEvent, - ExtendableEventInit, - and scope URL - are defined in [[!SERVICE-WORKERS]]. -