W3C home > Mailing lists > Public > public-payments-wg@w3.org > January 2016

Re: [paymentrequest] Use navigator.payments rather than creating a new object instance (#42)

From: bifurcation <notifications@github.com>
Date: Wed, 20 Jan 2016 08:26:49 -0800
To: WICG/paymentrequest <paymentrequest@noreply.github.com>
Message-ID: <WICG/paymentrequest/issues/42/173260987@github.com>
I think there's a missing distinction here between *how* you're willing to be paid and *what* you want to be paid.  The former question is the one that the user needs to be involved in, and it has a very clear event model -- you request a payment provider with some bounds, and the user hands you one.  Then you request what you want from that provider.

var how = { /* how am i willing to be pad? */ };
var what = { /* what do i want to be paid? */ };
.then(provider => provider.requestPayment(what));

This also lets us reflect all these questions around different payment schemes, shipping addresses, etc. in the type system for what's returned by `getProvider()`.  The top-level `PaymentProvider` interface might only have the `requestPayment()` method, but you could have sub-interfaces that define more nuanced interactions, or expose additional capabilities (`if (provider.shippingAddress) ...`).

This also aligns pretty cleanly with the idea of registration and delegated payment.  When you register a payment provider, you need to provide the browser what it needs to fulfill the `PaymentProvider` interface.

Reply to this email directly or view it on GitHub:
Received on Wednesday, 20 January 2016 16:27:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:43:13 UTC