From dc913b844e131a5f5c3156a41328da1154f2dee8 Mon Sep 17 00:00:00 2001
From: "Adam Roach [:abr]"
+ Where it appears, The TODO: flesh out details after the WG reaches general
+ consensus on the shape of this API.
+ Where it appears, The TODO: flesh out details after the WG reaches general
+ consensus on the shape of this API.
@@ -948,8 +1071,15 @@
+ This section is obsolete. The current proposal involves folding
+ the payment app matching (based on the entries in
+
- When the mediator calculates acceptedMethods during the
+ Registration and Unregistration
Note: Registration is not
necessarily a prerequisite to be able to use other types
of payment apps (e.g., native payment apps).
- Recommended Payment Apps
interface PaymentAppManager {
- Promise<void> setManifest(PaymentAppManifest manifest);
- Promise<PaymentAppManifest> getManifest ();
+ attribute PaymentOptions options;
+ attribute PaymentWallets wallets;
};
+
+
+
+ options
attributewallets
attribute
+ PaymentOptions interface
+
+
+ interface PaymentOptions {
+ Promise<boolean> delete(DOMString optionKey);
+ Promise<PaymentAppOption> get(DOMString optionKey);
+ Promise<sequence<DOMString>> keys();
+ Promise<boolean> has(DOMString optionKey);
+ Promise<void> set(DOMString optionKey,
+ PaymentAppOption details);
+ };
+
+ optionKey
parameter is a unique
+ identifier for the option; it will be passed to the payment app to
+ indicate the PaymentAppOption selected by the user.
+
+ PaymentAppOption dictionary
+
+
+ dictionary PaymentAppOption {
+ required DOMString name;
+ sequence<ImageObjects> icons;
+ sequence<DOMString> enabledMethods;
+ object capabilities;
+ };
+
+
+
+ name
membername
member is a string that represents the
+ label for this payment option as it is usually displayed
+ to the user.
+ icons
membericons
member is an array of image objects that
+ can serve as iconic representations of the payment
+ option when presented to the user for selection.
+ enabledMethods
memberenabledMethods
+ member lists the payment method identifiers of the
+ payment methods enabled by this option.
+ capabilities
membercapabilities
+ member contains a list of payment-method-specific capabilities
+ that this payment app is capable of supporting for this option.
+ 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
.
+
+ PaymentWallets interface
+
+
+ interface PaymentWallets {
+ Promise<boolean> delete(DOMString walletKey);
+ Promise<WalletDetails> get(DOMString walletKey);
+ Promise<sequence<DOMString>> keys();
+ Promise<boolean> has(DOMString walletKey);
+ Promise<void> set(DOMString walletKey,
+ WalletDetails details);
+ };
+
+
+ walletKey
parameter is a unique
+ identifier for the wallet.
+
+ WalletDetails interface
+
+
+ dictionary WalletDetails {
+ required DOMString name;
+ sequence<ImageObject> icons;
+ required sequence<DOMString> optionKeys;
+ };
+
+
+
+
name
membername
member is a string that represents the
+ label for this wallet as it is usually displayed
+ to the user.
+ icons
membericons
member is an array of image objects
+ that can serve as iconic representations of the wallet when
+ presented to the user for selection.
+ optionKeys
member
@@ -899,43 +1010,55 @@
navigator.serviceWorker.register('/exampleapp.js')
.then(function(registration) {
- return registration.paymentAppManager.setManifest({
- name: "ExampleApp",
- icons: [
- {
- src: "icon/lowres.webp",
- sizes: "48x48",
- type: "image/webp"
- },{
- src: "icon/lowres",
- sizes: "48x48"
- } ]
- options: [
- {
- name: "Visa ending ****4756",
- id: "dc2de27a-ca5e-4fbd-883e-b6ded6c69d4f",
- enabledMethods: ["basic-card"]
- },
- {
- name: "My Bob Pay Account: john@example.com",
- id: "c8126178-3bba-4d09-8f00-0771bcfd3b11",
- enabledMethods: ["https://bobpay.com/"]
- },
- {
- name: "Add new credit/debit card to ExampleApp",
- id: "new-card",
- enabledMethods: ["basic-card"]
+ registration.paymentAppManager.options.set(
+ "dc2de27a-ca5e-4fbd-883e-b6ded6c69d4f",
+ {
+ name: "Visa ending ****4756",
+ enabledMethods: ["basic-card"],
+ capabilities: {
+ supportedNetworks: ['visa'],
+ supportedTypes: ['credit']
}
- ],
- canHandle: function (methodData, details) {
- // TODO: Code here to return mapping from payment option IDs
- // to methodData option indices.
- }
- });
- }).then(function() {
- console.log("Installed payment app from /paymentapp.js"); // Success!
- }).catch(function(error) {
- console.log(error);
+ });
+
+ registration.paymentAppManager.options.set(
+ "c8126178-3bba-4d09-8f00-0771bcfd3b11",
+ {
+ name: "My Bob Pay Account: john@example.com",
+ enabledMethods: ["https://bobpay.com/"]
+ });
+
+ registration.paymentAppManager.options.set(
+ "new-card",
+ {
+ name: "Add new credit/debit card to ExampleApp",
+ enabledMethods: ["basic-card"],
+ capabilities: {
+ supportedNetworks:
+ ['visa','mastercard','americanexpress','discover'],
+ supportedTypes: ['credit','debit','prepaid']
+ }
+ });
+
+ registration.paymentAppManager.wallets.set(
+ "12a1b7e5-16c0-4c09-a312-9b191d08517b",
+ {
+ name: "Acme Bank Personal Accounts",
+ icons: [
+ { src: "icon/lowres.webp",
+ sizes: "48x48",
+ type: "image/webp"
+ },
+ { src: "icon/lowres",
+ sizes: "48x48"
+ }
+ ],
+ optionKeys: [
+ "dc2de27a-ca5e-4fbd-883e-b6ded6c69d4f",
+ "c8126178-3bba-4d09-8f00-0771bcfd3b11",
+ "new-card"
+ ]
+ });
});
Payment App Matching
+ PaymentAppOption.capabilities
) into the base Payment Request
+ specification.
+
+ When the user agent calculates acceptedMethods during the
process of running the steps for the PaymentRequest.show()
method, the means of determining whether a registered payment app
should be made available for user selection is computed by
@@ -960,7 +1090,7 @@ Payment App Matching
enabledMethods
to
registeredMethods.
Payment App Matching
corresponding PaymentAppOption
.
+
enabledMethods
to
registeredMethods.
enabledMethods
to
+ payment app's PaymentAppManager.options, add all
+ entries in option.enabledMethods
to
registeredMethods.
interface PaymentAppManager { - attribute PaymentOptions options; + attribute PaymentAppOptions options; attribute PaymentWallets wallets; };@@ -630,6 +630,10 @@
Is "options" the right term here? We don't want this to + get conflated with "PaymentOptions" in the payment request + specification. Other alternatives might be "instruments" or "accounts." +
wallets
attribute- interface PaymentOptions { + interface PaymentAppOptions { Promise<boolean> delete(DOMString optionKey); Promise<PaymentAppOption> get(DOMString optionKey); Promise<sequence<DOMString>> keys(); @@ -1090,7 +1094,7 @@Payment App Matching
PaymentAppManager.options
, add all entries in
option.enabledMethods
to
registeredMethods.
PaymentAppManager.options
, add all entries in
option.enabledMethods
to
registeredMethods.
PaymentAppManager.options
, add all
entries in option.enabledMethods
to
registeredMethods.