Re: [w3c/payment-request] Allow custom data for the active payment method to be provided to `PaymentResponse.prototype.complete` (Issue #981)

@cyberphone wrote: 
> I must though admit that I don't fully understand the motivation since a normal payment application (in a Web context NB...), would rather return with a message from the Merchant. In addition, this kind of information can be provided in https://www.w3.org/TR/payment-request/#dom-paymentmethoddata

The addition `.data` is be dependent on how the payment is to `.complete()`: "success", "failure", "unknown". So, it's may not possible to know what the `.data` might be  before the merchant calls `.complete()`... otherwise, the merchant would need to pass every possible `.data` for every possible completion type. 

That would be super ugly:

```JS
const methodData = [
  {
    supportedMethods: "https://example.com/payitforward",
    data: {
      payItForwardField: "ABC",
      "success": {theme: "party-town"},
      "failure": {theme: "sad-town"},
    },
  },
  {
    supportedMethods: "https://example.com/bobpay",
    data: {
      merchantIdentifier: "XXXX",
      bobPaySpecificField: true,
      "success": {bobThing: "fooo"},
      "failure": {other: "bar"}
    },
  },
];
``` 




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

Message ID: <w3c/payment-request/issues/981/1016199951@github.com>

Received on Wednesday, 19 January 2022 08:33:19 UTC