Re: [w3c/payment-request] Remove modifiers (#957)

> It would be quite unfortunate if Firefox one day shipped support for PaymentRequest and PaymentHandler, and Google Pay were 'punished' for writing their code to a valid version of a spec because we felt something was was messy and had removed it. (I.e. Firefox would not pass the 'modifiers' through to the app, and so it would break)

That presupposes quite a few things - in particular, that GPay couldn't be updated to not use modifiers and achieve the same functionality. However, it's fair to ask, "how could GPay be updated to work without the use of modifiers?" 

Again looking at the code above, I concede that the use of `.data` serves the purpose of communicating out-of-band things (e.g., "'data' contains the information from the merchant on new shipping options"). 

A future version of the specification should work like this:

```JS
/* In the merchant page */
pr.onpaymentmethodchange = function(e) {
  const data = getNewShippingOptionsFor(e.methodDetails)
  // e is already coming from a `methodName` (e.g., GPay), so: 
  e.updateWith({ data });
}
```

As modifiers are just being used to hack around a flaw in the spec (I can't think of a  reason why one would modify multiple payment methods at once). 


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-request/pull/957#issuecomment-844650069

Received on Thursday, 20 May 2021 03:09:27 UTC