diff --git a/index.html b/index.html index 74834ab..95dd084 100644 --- a/index.html +++ b/index.html @@ -355,8 +355,15 @@
interface PaymentAppManager { - Promise<void> setManifest(PaymentAppManifest manifest); - Promise<PaymentAppManifest> getManifest (); + attribute PaymentAppOptions options; + attribute PaymentWallets wallets; };+
options
attributeIs "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 PaymentAppOptions { + 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); + }; ++
+ Where it appears, The 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.
+
TODO: flesh out details after the WG reaches general + consensus on the shape of this API.
++ 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
.
+ + 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); + }; ++ +
+ Where it appears, The walletKey
parameter is a unique
+ identifier for the wallet.
+
TODO: flesh out details after the WG reaches general + consensus on the shape of this API.
++ 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
membernavigator.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" + ] + }); });
@@ -948,8 +1075,15 @@
+ This section is obsolete. The current proposal involves folding
+ the payment app matching (based on the entries in
+ PaymentAppOption.capabilities
) into the base Payment Request
+ specification.
+
- When the mediator calculates acceptedMethods during the
+
+ 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 +1094,7 @@ Payment App Matching
PaymentAppManager.options
, add all entries in
option.enabledMethods
to
registeredMethods.
PaymentAppOption
.
+
PaymentAppManager.options
, add all entries in
option.enabledMethods
to
registeredMethods.
enabledMethods
to
+ payment app's PaymentAppManager.options
, add all
+ entries in option.enabledMethods
to
registeredMethods.