Comments (7)
So, what is our design approach for the browser API?
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:
- It helps us clearly delineate the payment messages from the things you can do with those payment messages (this helps us more easily use the same messages for the HTTP API and the browser API and align w/ ISO20022).
- It simplifies the browser API and thus reduces the cognitive load on developers as it's clear that you have payment data and things you can do with that payment data.
- It avoids unnecessary complexity in the browser implementations by making the browser just a payment message router instead of exposing a payment request state machine to the payee.
- It's more flexible, as a data-only approach decouples behavior from the data.
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
from webpayments.
See also: Rule of Least Power.
from webpayments.
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.
from webpayments.
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
from webpayments.
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).
from webpayments.
Moved @msporny proposal to it's own issue so that the discussion may continue on this thread if the proposal is not accepted.
from webpayments.
Migrated to w3c/payment-request#47
from webpayments.
Related Issues (20)
- [Payment apps] How can we optimize user experience when there is only one match? HOT 1
- Pull filters out of payment method data HOT 2
- Overview document figure 5 HOT 13
- Propose a payment method specification that includes an example of field level security HOT 1
- propose to add encoding attribute to data set HOT 18
- European market - Security concerns HOT 10
- [Tokenized Card Payment] Replace usage of 'last4' with 'suffix' HOT 8
- [Tokenized Card Payment] TokenCardRequest should inherit from BasicCardRequest HOT 3
- 3D secure support HOT 4
- Sepamail WebIDL syntax and algorithms HOT 4
- Payment Method Manifest spec - should enable country specific app discovery HOT 9
- Fingerprint and version metadata (in Web App Manifest spec) HOT 36
- Should the WPWG develop a cryptocurrency payment method specification HOT 14
- Adopt a "test as you commit" policy HOT 10
- Just a question, curious HOT 1
- Visual Identity for Web Payments HOT 14
- Specify both pickup and delivery addresses in a single payment request HOT 2
- QR use cases HOT 5
- Proposal to restore charter text around UI being out of scope HOT 10
- Pagos alex
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpayments.