w3c / payment-request

Payment Request API
https://www.w3.org/TR/payment-request/
Other
488 stars 135 forks source link

Question about use case Payment Request API #1033

Open AdaltonLeite opened 1 week ago

AdaltonLeite commented 1 week ago

Hi Team,

I would like to know more about a use case for the Payment Request API.

We have a scenario where we are at a store checkout and we need to authenticate the user on a parent site, this site contains all their saved data, such as cards and shipping data. To do this, we would start a session within the Payment Request API environment and only return a token that allows the checkout site to read the data saved on the parent site.

Sem título-2024-09-11-0916

Our question is, do you see that this can be implemented? Have you seen scenarios similar to this? Would it be a use case for this API?

ianbjacobs commented 1 day ago

@AdaltonLeite,

Suppose the parent site provides a payment handler, and that payment handler is capable of authenticating the user, retrieving stored data, and returning it.

It should be possible to use Payment Request for that scenario.

You would define the inputs/outputs for the payment handler in a payment method description (with an associated payment method identifier).

The store would use Payment Request with that payment method identifier, and when the user pushes the "Pay" button, the payment handler would open, support authentication, and then do whatever it wants before user says "ok" and the payload is returned as the output of Payment Request.