-
Notifications
You must be signed in to change notification settings - Fork 28
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
Don't use PaymentRequest #5
Comments
That's an interesting alternative approach, which I think deserves some thought. My initial reaction is that we do want to use PR here, and not define a new way of making a purchase. There's a lot of infrastructure set up to deal with payments in PR which we'd have to duplicate here. A purchase of a digital good is still a payment. It has all the semantics of making a payment, including the presence of a "total" in the user's currency. The only difference is that "total" is not passed in as a parameter from the site, rather, it is transmitted to the payment provider out-of-band (e.g., by the developer configuring it in an admin console). |
Having two different APIs for purchases on the web seems awkward at best. |
So the intent is to have a particular kind of payment handler deal with these (in the context of a payment sheet)... if so, it would make sense. Alternative is what @adrianhopebailie suggests... you pull the purchase details from the |
@marcoscaceres wrote:
Correct. There're several payment apps that work this way out there. For example, https://github.com/j3k0/cordova-plugin-purchase#getting-started lists out: @marcoscaceres wrote:
No, the website knows the price through the digital goods service and typically displays it for the user to see. |
Awesome, thanks for the examples! |
To expand on this: while the website knows the price through the digital goods API (as an output of that API), we don't want to require the site to send the price back into the system (as an input to payment request), which would be redundant, since the system already knows the price of the item. (Then we'd have to specify what happens if you ask to buy an item for $X dollars when the server knows it costs $Y dollars.) |
@mgiuca, yeah, that makes sense. Thank you. @adrianhopebailie is correct in that this proposal does modify the Payment Request API to (also!) become a "purchase API"... but that's probably ok so long as it doesn't prevent the PR API to continue to function as a "payment API". That is, we get "the best of both worlds"... and that's good, right? |
This problem still exists. What if I query the server and get told the item costs $X but when I submit the purchase through the PR API I get charged $Y? |
Are any of these assumptions I'm making incorrect:
This use of the different APIs still feels very awkward to me. Why would I use browser APIs to communicate with a back-end service that I could just as easily communicate with using |
My intuition matches what @rsolomakhin says above:
I have some clarifying questions:
This edge case seems similar to those that need to be handled anyway. e.g. failed payments, out of stock ("no more shiny sword for you!"), and charged-back payments. Is it so unique that it warrants a new API? |
Then why is the Digital Goods API (for purchasing digital goods) a different API to the Payments API (for making payments)? We are already fighting with the privacy implications of the payments API having too much non-payments functionality (shipping address, email, etc) and now we want to start supporting more non-core use cases?
Linked in the explainer: w3c/payment-request#912
The Payment Request API is for requesting a payment, irrespective of how that payment is processed by the user. The proposal is to remove the amount and submit payment requests that can ONLY be processed by the app store. If the payment can only be processed by the app store, why submit them via a browser API at all, just submit them directly to the store via
Correct. So we shouldn't change the whole nature of the Payments API to avoid this edge case. If the website knows what the shiny sword should cost it should request that amount from the API. |
The Digital Goods API as proposed here is primarily an API for consuming and acknowledging digital goods that are already purchased. It still relies on the Payments API to facilitate the "buy flow": i.e. invoking the relevant digital store as a payment app and taking user through that payment flow. If we don't use Payment Request API, then the Digital Goods API would need to provide facilities for invoking a buy flow. This would lead to a more confusing state with two different APIs for making payments on the web.
We are proposing that there is a category of payment methods that does not require a price as input. When a developer creates a However, if a developer creates a
In this particular case,
Just to re-iterate, the primary reason why Digital Goods API need to exist is because it does not make sense to jam the Today, not all native apps that make use of in-app-purchase query item details before invoking the buy flow. For example, a game may show "buy gem" without showing the price. So we could tell these developers to simply use a dummy "total", but that would seem pretty odd, wouldn't it? |
this still feels kinda weird... I'm still not really convinced that communication with the |
@marcoscaceres There's really only one reason for this to exist, and it's a kinda dumb one, but these stores often do not provide REST endpoints. (Such as the Play Store.) They are designed to be called from native apps on their respective systems, so they provide Java APIs or whatever native SDK is used. If we could get them to expose REST endpoints, then there wouldn't be much need to have this API exposed by the browser. But the fact is, there is no other way that we can facilitate a website to talk to a private system API like this, than to expose it through the browser. I think @danyao put it best above:
|
Ok. I missed @danyao comment! Sorry, about that. Ok, let's go with the model whereby it's a system service that is the same as Geolocation (e.g., browser talks to "Skyhook" or whatever... I think that's what Firefox does IIRC). It seems feasible that interrogating the The Payment Handler itself could then just discard |
One clarifying question: if I have a random site (e.g., marcosc.com) and I call this API, how does the I guess I'm wondering because there seems to be a lot of parallels to how this works and how Apple Pay works with respect to setting up a site. <-> payment handler relationship. So, I can understand the "does not provide REST endpoints" issues... but if I need to establish a "B2B" relationship between marcosc.com, and, say, (system) bobpay.com, then why not also establish the REST endpoints between the servers? That just seems like, um, "laziness" on the part of the Payment Handler provider and not a technical or security constraint. |
Interesting idea...
Yes, that would be up to an out-of-band relationship between sites and payment servers. Which is much the same as how you need to set up an out-of-band relationship between your site and a payment handler in the Payment Request flow.
That's true, but we aren't in control of that. As spec writers / browser vendors, we can only write specs and implement browser APIs. I agree, it isn't ideal, but it's a solution to a problem that would not otherwise solve itself. |
Similarly, an argument could be made that a digital-goods service query relationship could be established out-of-band: if one is setting up a bunch of certs to verify that a payment went through, then surely one can set up a simple service to query for digital goods info, no? For example, marcospay.com would just provide "awesomegame.com" an API key. Then awesomegame.com can do as many digital-goods lookups server-to-server as it wants.
In a way we - spec writers / browser vendors - can be in control of it: we can say, "we have this really nice Fetch API that allows you to do all that you want: if you kindly expose a REST API, it will do everything that you need and more! < fetch API sales pitch goes here ... extensible web manifesto ramble here... jazz hands... jazz hands... >... and that's why Note that the "merchant validation" can still happen within
In a way, it could: sites can just use whatever payment handler they want right? What's preventing them from just using, say, a hypothetical marcospay.com (which could also provides a nice REST API for getting details)? |
Right, but you'd be making that pitch to an app store operator who is primarily interested in running a store for native apps. There is no incentive for them to build and maintain a whole separate entrypoint to their API just for PWAs. We're the ones who want this, so we need to build it.
Unfortunately, that wouldn't be an option in the use case I'm considering. (As outlined at the top of the explainer,) if your app has been listed in an app store, and installed via that store, the store policy would prevent you from being able to accept payments for digital goods outside of their billing API. So you could not use marcospay.com. That's why this is so important for us: right now, PWAs listed in the Google Play Store are prevented from accepting payments in any way. This API enables that. Note that the API spec as proposed does not have this restriction built into it (for example, you could make a marcospay.com digital goods provider). It's just that in the specific context of a PWA installed via the Play Store (or another app store), you wouldn't be able to use another digital goods provider. |
Ok, that's extremely unfortunate. The question to ask is if it justifies adding an API to the Web Platform (i.e., ideally to every web browser) because of the policy of a particular app store? an important store, but still...
I understand that Chrome needs this, but let's put this in the context of the wider Web Standards project. Like, how do I go and sell this to Mozilla to get it added into Gecko? By adding this API, we would be kinda shooting ourselves in the foot to placate a Google problem, right? because essentially Google's Play Store is forcing developers to use a Google Payment Solution to be listed in a Google Store at the exclusion of all other payment solutions - and by being stubborn, Google Play is forcing Google Chrome to add this API. And not for any valid technical reason, but because of a policy which they could change tomorrow. Although convenient that this policy is expressed as a browser I'm not saying you shouldn't add this to Chrome, but is this really a "web API" or a "Play Store API"?
Right, but gets us back to the whole Payment Handler, or general web platform, integration discussion. If we put aside the Google Play Store policy, it still appears that fetch addresses all the technical use cases. So, policy aside, is there any technical reason for this API to exist? |
Agreed.
Noted. I should be more careful when I say "we". Chrome wants this, for sure. But I was trying to mean "we" the greater web platform community. I think it should be our goal to try and work with app stores and not wall ourselves off. We hear a lot from developers that the decision to make a PWA vs a native app often comes down to "will it appear in the major stores"? I hate it when they're making this on a "how can people find my app" basis, rather than based on the technology, but it's the reality. Stores have very little incentive to carry web apps (since they're primarily focused on native apps). On the other hand, we (the web community) have a lot of incentive to have stores list the apps built with our platform. So I believe it is in our best interest to cooperate.
I believe Firefox is looking into TWAs, right? I'm not sure on all the details here, but it's possible that installing an app from the Play Store could use Firefox as the engine, if it's set as the user's default browser. (I could be mistaken... I don't know exactly what the policy is here.) If that's the case, Firefox would serve the exact same role as Chrome: as an intermediary between the website and the store. Firefox would have to implement this API, otherwise if the user is using Firefox, those websites would not be able to make purchases if installed via the store. That's ultimately why we decided to take this to WICG and not just expose it in Chrome: because as with any web API, it enables a website to use the service regardless of which browser the user is using.
This isn't intended to be Play only. The same could apply to the Samsung Store, or any other app store. It's a similar centralization model to Payment Request itself. It's not a truly open API that works with any backend. The site needs to interop specifically with this store or that store. But by making a standard API, at least the site doesn't also need to interop with this browser and that browser. They can use a standard interface to talk to the Play Store, or the Samsung Store, for example. Background context: we did originally design this as a "Play Store API" (see this thread). But our web platform folks rightly suggested that this wasn't exclusive to Chrome, or the Play Store, and so we should take it through the public standards process. So here we are, four months later :)
I consider it to be a technical barrier (not a policy barrier) if a web developer would be unable to integrate with a store unless they can convince the store to build a whole new API. Doing so would be out of the developer's hands. Thus, I propose an API that would empower the developer to integrate with that store without needing that store to change the way they operate. |
Thanks @mgiuca for the additional details. Mozilla is only experimenting with TWAs, but would being a TWA prevent a browser engine from providing additional built-in payment handlers (e.g., let's say Firefox was a TWA but it also has built-in support for other payment solutions/handlers)? ... or would that render Firefox an "untrusted web activity" and get it booted from the Play Store? It be great to hear from other folks about what they think. @adrianhopebailie? |
The assertion that stores have no incentive to solve this has come a lot:
and
I don't agree with this. Stores are incentivised grow their ecosystem, which is a two sided market. They want to attract developers so their store gets more good apps which attracts users. They want to attract users so they have a wider distribution platform which attracts developers. Attracting developers means giving them the best tools to build and make money from their apps and the widest distribution platform. The size of the Web developer community far exceeds the native app community so if you are attracting Web developers to your platform you have a much larger addressable market. You attract Web developers by giving them the same features and services you give native app developers, in this case the ability to sell digital goods and subscriptions with very low user friction. So, I would argue that there is a strong incentive for app stores to provide Javascript SDKs to PWA developers so they can access the store's services from the Web. Presumably this would still require that the developer has an app store account and be subject to same terms when accessing these services as they would in the app store. The real problem I think this API solves is allowing the app store to enforce their terms. If apps use digital goods services via the APIs on the Internet (vs via a browser API) it's impossible for the app store to know if the app was loaded via the app store (and is therefor subject to the app store terms) or via the Web. This presents two problems:
I believe what we really want, to start with, is a solution to problem 1. Apps need a way to get a handle/pointer to the app store user id of the user using the app. If this is not present then the app knows it is being accessed outside the app store context and is not subject to the app store's terms. It should also not attempt to use the app store's services (it likely won't be able to without a handle/pointer to the app store id of the user using the app). It will then be up to the app stores to decide how (or if) they enforce their policies around preventing apps from accessing competitive services when in an app store context. A positive side-effect of this is that app stores that embrace this potentially extend their total addressable user market beyond their native platforms. For example, an app that is written for the Web but also distributed via an an app store may prefer to use the app store's digital goods services even when accessed via the Web on a desktop device simply because it is a great user experience. App stores could enable this by simply making it easy for users to sign up for an account via the Web (which I think they all support already). |
I think there's a misconception here that the Digital Goods API as proposed would somehow only benefit the Play Store and hurt the open web. Here are the reasons why I believe it is not true:
I think Gecko should consider this proposal for the same reason it should consider Payment Request API. It will help developers build better commerce experiences on the web for users. The Internet has been likened to a bazaar [1]. A bazaar is not a showroom: vendors and users have to be able to not only discover each other but complete transactions. IMHO, the web is becoming more like a showroom these days and users are having transactions where it is easy to do so. Developers are following them. They may not come back one day. So it is on us, the web platform community, to offer developers the right tools to build a great bazaar to attract the users back.
This may be the immediate cause, but the bigger issue is that developers want to be listed in app stores. That's what gives app stores this leverage. This is also why I respectfully disagree with @adrianhopebailie 's comment:
We are not fundamentally solving an app store problem. They were not the ones who came to us asking for this API. We are solving a web developer problem: they want to list in app stores (partially because there's no good way to monetize on the open web besides ads) and they don't have good ways to build IAP flows. I think as tool builders, we can tackle this problem two ways:
Folks like Stripe, PayPal are doing a great job pushing the first front, especially for regular sized transactions. They are not addressing the IAP use cases (yet?). Coil is making good strides for IAP-type experiences. But solutions are both few and far between today and fragmented, so it is hard for web developers to adopt. I hope Digital Goods API will become a standard access point for web developers to access all IAP providers. That said, the first way takes time. In the mean time, browsers can help "import" good native experiences to the web. I believe integrating Play Store behind Digital Goods API is a good first step, as long as we take care to make sure we choose a design that's extensible, so when the pure-web solutions become available, they can easily plug in as well, and the developers get upgrade for free. I feel the pushbacks on this thread are calling for the former path at the exclusion of this second path, which I believe is putting theoretical purity ahead of user and developer needs, and will have the consequence of making the web fall further behind on the commerce regard. I hope the proposal authors' intention to keep DG API an open solution is evident in that we designed it to work in conjunction with Payment Request API. If we (the evil Google guys??) really want to push a Play Store only solution to lock the web out, it would have been much easier to create a Google specific API for Play Store in Chrome behind closed doors and not be having this conversation at all...
Perhaps we should have proposed #9 from the start... Does this PR address your concern that Digital Goods API is not sufficiently open? |
In a way it does... it again centralizes and privileges payment solutions to the ones provided/installed on the OS or by the browser. This is the same problem with including the default search engines lists... yes, they are useful (and make a lot of money for browsers, including Firefox!)- but they privilege those who already dominate the market or have pre-arranged deals with browser vendors. Replicating that model doesn't seem great, and relegates everyone else who wants to compete in this space to be second-tier.
On the face of it, this is true - but there is nothing special about the Digital Goods API experience that couldn't be replicated with a simple
I don't disagree with anything you stated here, but I don't see how this technically is superior to just using
This may be true for some developers, but not all developers. I can agree that developers want to be where people can find their apps. How users find apps vary a lot.
But there is nothing particularly fancy about this API that solves "hard problems" developers have right now. It's literally a method call that gives you back and object. Like, if this was doing a whole bunch of super fancy complicated browser stuff behind the scenes (like Payment Request/Handler does), then I'd be inclined to agree with you here... but this is just a network call to get some digital goods info from PMI-like URL? Why not just skip that and go directly to the source?
Hey! I won't have you saying bad things about my favorite Googlers! (but seriously, this is totally not where I think @adrianhopebailie and I are coming from... I'm just trying to say "we have the technology, let's just use it"... it's more, "Marcos is lazy... he doesn't want to build new APIs unless he really really has to".)
I don't feel it does... at least without the Payment Handler plan? |
Hi Marcos, Just on the technical notes:
It isn't possible to communicate with the Play Store, and possibly other stores, using JavaScript and We can argue about what it would take to have them change their server to support this, or the merits of us simply not supporting those stores since they aren't willing to "play ball". But that is the ask we're getting from developers, and the problem we're trying to solve. We're proposing a solution here. We're open to other solutions, but "just do it in user space" is not a functioning solution to the problem.
The bar for whether an API is useful enough is not "all developers". It's always "some developers". The question is how many (enough to make it worthwhile?). The jury is out on that, but luckily, we don't need to answer that question right away to get started. We need to prototype it out and run a trial and then we'll see how much interest there is.
It isn't (directly) a network call. The browser implementing this feature to talk to, say, the Play Store would not be directly making a network call to the server. It would be talking to an API in the Android SDK, and that in turn would privately make a call across the network. So this is much closer to a web API exposing an OS feature (that the OS typically exposes to its native platform), than a web API abstracting over a |
@mgiuca, @danyao, thanks again for the discussion, details, and for answering all my questions. This has been really helpful in understanding the API and overall idea. Although this is probably not something we would pursue at Mozilla, we will keep an eye on it as it evolves and can provide feedback as needed. |
I think this discussion has concluded, so closing the issue. |
It's not clear why this API needs to use the PaymentRequest API at all. The changes that this requires to Payment Request API changes the nature of that API from a payment API to a purchase API.
The whole point of the PR API is to allow a website to request a payment from the user when the website doesn't know yet what payment methods are available to make the payment.
This API only works if the user is using a browser connected to a specific Digital Goods Service.
Why not simply add a purchase method to the
DigitalGoodsService
?Example:
The text was updated successfully, but these errors were encountered: