WICG / webmonetization

Proposed Web Monetization standard
https://webmonetization.org
Other
466 stars 152 forks source link

Spec missing WM provider HTTP API #195

Closed networkimprov closed 1 year ago

networkimprov commented 3 years ago

I'm considering implementing WM in a non-browser app (specifically a TMTP client; see https://mnmnotmail.org).

I haven't found the HTTP API to contact a WM provider (e.g. Coil) to request payment.

In the specs for PaymentResponse, I find: HTTP example: https://www.w3.org/TR/payment-request/#posting-payment-response-back-to-a-server definition: https://www.w3.org/TR/payment-request/#dom-paymentresponse .details: https://www.w3.org/TR/payment-request/#dom-paymentresponse-details

The last says: Similarly, a URL-based payment method identifier defines the shape of details. However, as URL-based payment method identifiers are not standardized by the W3C, developers need to consult whoever controls the URL for the expected shape of the details object.

EDIT: PaymentRequest is mentioned in https://webmonetization.org/specification.html#payment-handler-flow However, PaymentResponse isn't mentioned in that document.

Is there a standard to request payment by a WM provider? If not, could that be defined?

PS: I need to be able to request specific payment values as well as start/stop streaming payments.

marcoscaceres commented 3 years ago

It may be handled by https://openpayments.dev ? @AlexLakatos do you know?

(in any case, it won't be related to the PaymentRequest API so don't bother looking there)

networkimprov commented 3 years ago

Thanks, looks like this is the API for a client app to request payments: https://docs.openpayments.dev/delegated

Is this the OAuth API mentioned on the Rafiki readme? https://github.com/interledger/rafiki

Should the Open Payments spec be linked in the WM spec? If so, I'll change the issue title to request that.

cc @uchibeke

marcoscaceres commented 3 years ago

@networkimprov wrote:

Should the Open Payments spec be linked in the WM spec? If so, I'll change the issue title to request that.

Yes, I think so. I'm the process of updating that too:

https://github.com/WICG/webmonetization/pull/193/files#diff-772384ebc24069774f1ac50dd3b8ba92c488eaca9a0029ce4aa0c3f65ce86de8R126

Note also that PR refactors the whole spec to use a <link> element instead + changes a bunch of things. Keep an eye on it, as it makes quite a few breaking changes.

networkimprov commented 3 years ago

Ah great.

I really have no standing to comment, but it might help to make separate commits for formatting vs content changes.

marcoscaceres commented 3 years ago

I really have no standing to comment, but it might help to make separate commits for formatting vs content changes.

It's a community effort, so you absolutely do :)

And yeah, that's why I sent it as a big draft for now for comment. I'll break it up into smaller pull requests.

AlexLakatos commented 3 years ago

It may be handled by https://openpayments.dev ? @AlexLakatos do you know?

(in any case, it won't be related to the PaymentRequest API so don't bother looking there)

I think that's handled by Mandates from the Open Payments API indeed. I don't know if Coil exposes that yet. @sharafian would know if that's the case.

networkimprov commented 3 years ago

Is there a draft W3C spec for Open Payments? If not, is that planned?

marcoscaceres commented 3 years ago

Is there a draft W3C spec for Open Payments?

No.

If not, is that planned?

That's a great question, actually. I've no idea who runs or supports "Open Payments", or what their licensing policy is.

We only realized that we had this dependency literally last Tuesday 😅

We should really sort that out.

networkimprov commented 3 years ago

It's from the Interledger Foundation. https://github.com/interledger/open-payments

One (maybe silly :) approach might be to add the OAuth/Mandates API to the WM spec, and generalize it to not be ILP specific.

cc @adrianhopebailie @kincaidoneil

AlexLakatos commented 2 years ago

The spec won't define a provider API, that's up to every provider to decide if they want to support non-browser web monetization, and if they want to provide an API. The current provider, Coil, actually specifies one: https://help.coil.com/docs/dev/oauth-api

networkimprov commented 2 years ago

This issue isn't specific to non-browser WM.

A browser vendor implementing WM needs to know how the browser makes requests to WM providers. It seems unlikely that browser vendors would accept site-specific APIs for each WM provider.

Have you heard specific feedback on this in the W3C discussions?

marcoscaceres commented 2 years ago

Reopening to explore further...

A browser vendor implementing WM needs to know how the browser makes requests to WM providers.

that would be SPSP + STREAM, right?

It seems unlikely that browser vendors would accept site-specific APIs for each WM provider.

Yeah, probably not.

huijing commented 1 year ago

This is now documented in OpenPayments: https://docs.openpayments.guide/docs