[webpayments] Should a payment request be just data, or a programmable object? (#36)

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

```javascript
var payment = new PaymentRequest(supportedInstruments, details, options, schemeData);
```

and can have methods called on it like so:

```javascript
payment.addEventListener("shippingAddressChange", function (changeEvent) {
    // Process shipping address change
});
```

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:

1. There is data, and functions act on that data (Web Payments CG approach).
2. There are objects that consist of data, and verbs that hang off of those objects (paymentRequest approach).

So, what is our design approach for the browser API?

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webpayments/issues/36

Received on Wednesday, 16 December 2015 05:00:48 UTC