[w3c/webpayments-payment-apps-api] payment-manifest.json and canHandle function (#83)

Hello,

It appears as though `payment-manifest.json` is a file containing json with information relevant to a payment app. My understanding of JSON is that it is a data interchange format and not a place where functionality is defined, as is the case with the `canHandle` field.

In it's current form the manifest file is not valid JSON and I would expect the contents of a .json file to contain valid JSON.

As we can see in the [Registration Example](https://w3c.github.io/webpayments-payment-apps-api/#register-example) There is some inline Javascript provided (Note: not JSON, see below). If we wanted to avoid duplication I would expect the parameter to `setManifest()` to come from the payment-manifest.json url but I think that would break.

Input from others would be great here but perhaps we could have the function encoded as a string and have the client deserialise and eval() it. I think that would be a hack though, as opposed to an acceptable solution.

Other possible solutions could be:
* Change the extension from .json to .js to denote regular Javascript code.
* Move the function into the actual payment app i.e. Service Worker, and expose it as a handler, similar to `paymentrequest`. I have a feeling the function is defined in the manifest so that it can be executed even if the app is not installed though.

JSON seems to be somewhat interoperable with Javascript meaning you can drop some JSON into Javascript source code and it will be interpreted as an object. You can even augment the object and define functionality, but when that occurs it is now Javascript code and no longer the JSON data interchange format.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webpayments-payment-apps-api/issues/83

Received on Tuesday, 10 January 2017 21:21:05 UTC