Re: [w3c/browser-payment-api] The myth of JSON-serializable object (#307)

> When would this filtering happen?

The filtering happens in the `.show()` method.

User agent checks the intersection of all the payment methods that the merchant website specified in `new PaymentRequest(supportedMethods, shoppingCart, options)` constructor with all payment methods that the installed payment apps have declared to support. If the intersection is non-empty, user agent lets the user select one of the payment apps. If the intersection is empty, the user agent rejects the `.show()` promise with `NotSupportedError` exception.

> How does it know it's unable to handle the payment request, until it parses and converts the object in the other process?

User agent cannot know this synchronously. The object needs to be serialized and passed to the payment apps first. @adamroach's latest take on the [Payment App API](https://adamroach.github.io/webpayments-payment-apps-api/#payment-app-options) has both [enabledMethods](https://adamroach.github.io/webpayments-payment-apps-api/#payment-app-options) sequence and [canHandle(supportedMethods, shoppingCart)](https://adamroach.github.io/webpayments-payment-apps-api/#payment-app-manifest) method that the payment app provides to the user agent at registration time. User agent can use these to asynchronously filter the payment apps that the user can select.

> Are you saying there is also some kind of implicit fine-grained introspection of the data there too?

This depends on the payment app. Some payment app might tell user agent that it [supports](https://adamroach.github.io/webpayments-payment-apps-api/#payment-app-options) "basic-cad", period. That's coarse grained. An other payment app might [inspect](https://adamroach.github.io/webpayments-payment-apps-api/#payment-app-manifest) the `supportedMethods` of the payment request to make a fine-grained judgement of whether it can handle that specific instance of "basic-card" payment request.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/issues/307#issuecomment-267156994

Received on Wednesday, 14 December 2016 21:08:47 UTC