-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should a payment request be just data, or a programmable object? #36
Comments
I assert that our design approach should be: "There is data and functions act on that data" There are at least three reasons to take this approach:
There is much more on the downsides of object-and-verb API design here: http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html |
See also: Rule of Least Power. |
It's fairly hard to imagine what a payment request gains from being code. If the payee has say preferences about instruments, then that could be encoded fine in data. It's easy to imagine web developers botching up payment requests though. |
Here's a proposal, since there doesn't seem to be any push-back on the issues list: The PaymentRequest object will not have code attached to it. It will be a pure data object (with no added Javascript functions) as demonstrated in: http://wicg.github.io/web-payments-browser-api/#processing-a-payment-request |
Let's also not forget that XMLHttpRequest is problematic API partially due to the fact that it stores state (like the PaymentRequest API proposal) and managing that state machine has led to code being more complicated than necessary for developers. The problem got so bad that there is a new Fetch API proposal that attempts to cut down on many of the state-machine related issues (among a slew of other non-state-machine-related issues). |
Moved @msporny proposal to it's own issue so that the discussion may continue on this thread if the proposal is not accepted. |
Migrated to w3c/payment-request#47 |
The paymentRequest API asserts that a payment request is a programmable object:
http://wicg.github.io/paymentrequest/specs/paymentrequest.html#paymentrequest-interface
that is instantiated like so
and can have methods called on it like so:
The Web Payments CG's Browser API asserts that a payment request is just data:
http://wicg.github.io/web-payments-browser-api/#processing-a-payment-request
and that data is processed by functions (see example in link above for a clear picture of what this looks like in practice).
These are two different general design approaches for the browser API:
So, what is our design approach for the browser API?
The text was updated successfully, but these errors were encountered: