diff --git a/proposals/paymentapps/payment-apps.html b/proposals/paymentapps/payment-apps.html index ffdcca9..25f0122 100644 --- a/proposals/paymentapps/payment-apps.html +++ b/proposals/paymentapps/payment-apps.html @@ -375,6 +375,7 @@
enabled_methods
enabled_methods
member
- The enabled_methods member
- lists the payment method identifiers of the payment methods
+ The enabled_methods
+ member lists the payment method identifiers of the payment methods
that can be processed by the payment app.
communication_methods
member
+ The communication_methods
+
member is a list of strings that defines how the user agent
+ can communicate with the payment app.
+
+ The communication_methods
list must contain one or both of the
+ values "javascript
" and "http
". If the member does
+ not exist or does not contain any of these two values, it will default to
+ the list that contains the single element "javascript
".
+
The user agent does this by, converting the payment
- request into a JSON serialized object, executing an HTTP POST
- request against the start_url
of the
- payment app.
At a minimum the user agent MUST handle the following two - responses from the payment app:
-- An HTML response that MUST be rendered by the user agent. -
-- When the browser gets HTML back from the payment app it must render this - UI for the user to interact with the payment app. Should this be in an iframe, - in a special modal dialogue or just a new tab? Is this an implementation - detail? -
-PaymentRequest.show
MUST resolve to this
- PaymentResponse.Before the PaymentRequest can be submitted to the - payment app it must be converted into a JSON serialized - string.
-The steps to convert the PaymentRequest
to
- JSON are given by the following algorithm. The algorithm
- takes a PaymentRequest (request) as input and
- returns a string.
- The algortihm for this conversion will depend on the outcome of - discussions around the shape of the PaymentRequest API. This - algorithm may also sit in the core messages spec. -
-- The fact that there are elements of this specification that can't be decided - until the Payment Request API is decided is another indication that the two - should be combined or have a normative dependancy. -
-How the user agent does this, depends on the communication method + selected for communicating between the user agent and the + payment app.
The steps to submit the payment request to the payment app - are given by the following algorithm:
-PaymentRequest
- to JSON.Member | -Value | -||
---|---|---|---|
URL |
- The value of the start_url member of payment
- app |
- ||
method |
- The value "POST " |
- ||
header list |
-
-
|
- ||
body |
- The value of payment request | -
Switch on response's MIME type
-PaymentResponse
from JSON using the
- response's body as input.The user agent may select any one communication method from the
+ intersection of the communication_methods
manifest
+ member and the communication methods supported by the user agent.
Unless the selected payment app is built into the user - agent or uses a proprietary mechanism for launching and - interfacing with the payment app, the user agent MUST - launch the payment app based upon the response it gets from - submitting the PaymentRequest.
-The MIME Type and other signals are used to determine how the - app is launched and what type of app is launched.
+This communication method is suitable for Browser-based payment apps that + display an HTML user interface. They communicate using the following + javascript API:
+ ++ partial interface Navigator { + readonly attribute PaymentsApi payments; + }; + + partial interface PaymentsApi { + PaymentRequest getRequest(); + Promise<boolean> submitPaymentResponse(PaymentResponse response); + }; +
If the payment app is a web application with an HTML-based user
- interface then the response will have a MIME Type
of
- text/html
.
If a user agent receives a response with a MIME
- Type
of text/html
it MUST assume that the
- response body is the HTML that must be rendered as the user
- interface of the payment app.
The user agent MUST execute the steps to render a - web based payment app as given by the following algorithm. - The algorithm takes a [[!FETCH]] Response - (response) as input:
+ web based payment app as given by the following algorithm.start_url
+ in the new context.The payment app can retrieve the payment request from the browser by
+ calling getRequest
.
The user will interact directly with web based payment + apps in the context created for this purpose + by the user agent.
+When the payment app is ready to do so, it must submit a
+ PaymentResponse to the user agent that can be
+ returned to the website that submitted the initial
+ PaymentRequest. It does this by calling
+ submitPaymentResponse
.
This communication method is intended for payment apps that do not require + a user interface, and communicate the payment requests and responses as JSON + over HTTP.
+Before the PaymentRequest can be submitted to the + payment app it must be converted into a JSON serialized + string.
+The steps to convert the PaymentRequest
to
+ JSON are given by the following algorithm. The algorithm
+ takes a PaymentRequest (request) as input and
+ returns a string.
+ The algortihm for this conversion will depend on the outcome of + discussions around the shape of the PaymentRequest API. This + algorithm may also sit in the core messages spec. +
++ The fact that there are elements of this specification that can't be decided + until the Payment Request API is decided is another indication that the two + should be combined or have a normative dependancy. +
+The steps to submit the payment request to the payment app + are given by the following algorithm:
+PaymentRequest
+ to JSON.Member | +Value | +||
---|---|---|---|
URL |
+ The value of the start_url member of payment
+ app |
+ ||
method |
+ The value "POST " |
+ ||
header list |
+
+
|
+ ||
body |
+ The value of payment request | +
PaymentResponse
from JSON using the
+ response's body as input.- partial interface Navigator { - readonly attribute PaymentsApi payments; - }; - - partial interface PaymentsApi { - Promise<boolean> submitPaymentResponse (PaymentResponse response); - }; - - --
The user will interact directly with web based payment - apps in the context created for this purpose - by the user agent.
-When the payment app is ready to do so, it must submit a
- PaymentResponse to the user agent that can be
- returned to the website that submitted the initial
- PaymentRequest. It does this by calling
- submitPaymentResponse
.
If the payment app is a web service that requires no user
- interface then the response must set the Content-Type
- header to the value application/json
and the response
- body should be a JSON serialized payment response object.
The steps to create a PaymentResponse
from
JSON are given in the following algorithm:
The user agent must return a PaymentResponse to the website that originally initiated the PaymentRequest. The steps for returning the PaymentResponse are @@ -669,15 +642,12 @@
submitPaymentResponse
then
- set response equal to the first parameter passed to
- that method.PaymentResponse
from JSON.submitPaymentResponse
method.PaymentResponse
+
from JSON.