Re: [w3c/payment-handler] "Middleman Id/Commission %/Payeeer" provision (#335)

Hi @richardPAG sorry for the slow response, I think I finally understand your use case properly.

Something worth noting upfront is that the API intentionally differentiates between generic payment data and payment-method-specific data. 

For example, the `total` is generic but `supportedNetworks` in a `basic-card` request is specific to `basic-card`. Basically, anything that is passed in the `data` field of an object in the payment method data array (example below) is specific to the payment method. 

This allows us to keep the standardized API surface small but still allows payment methods to innovate.

It does happen that we identified some data element that is payment-method-specific that could be elevated to the generic data model. An example is billing address which is specified for `basic-card` but we increasingly see is applicable to all payment methods.

I believe disbursements could be in the same category. i.e. The payment methods that support it will specify how to use the feature in their own data models and if there is agreement that this is worth elevating based on experience from its use then we will do that.

So initially I'd anticipate a request to look like this (using the 3 examples of payment methods that already support this to some extent):


```
const methodData = [
  {
    supportedMethods: "https://square.com/",
    data: {
      parties: [{ 
        merchantId: "super-mini-cabs",
        portion: 0.1
      },{ 
        merchantId: "driver-fred",
        portion: 0.9
      }],
    },
  },
  {
    supportedMethods: "https://stripe.com",
    data: {
      application_fee_amount: 1.00,
    },
  },
  {
    supportedMethods: "https://paypal.com",
    data: {
      payouts: [{ 
        paypalId: 12478764,
        amount: 1.00
      },{ 
        paypalId: 23448764,
        amount: 9.00
      }],
    },
  },
];
```

This is obviously completely made up but already it's clear that some standard here would be a challenge.

 - Are disbursements explicit or calculated on a ratio?
 - How do we standardize on payee identifiers?

Another 2 observations: 
  1. In your use case I would assume SMC to already know, at the time they invoke the API, which payment method Fred has chosen to use. So constructing a request that is specific to that payment method seems likely I see little value in constructing a request for multiple methods with a standardized disbursement data payload or am I missing something?
  2. This case only really applies when the payment handler invokes the payment which we see as an increasingly rare case. Rather it seems more likely that the payment handler will return some credential that the merchant uses to pull the payment. At this point I'd expect the PWA to pull the payment and deal with disbursing the funds to the driver, no?



-- 
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-handler/issues/335#issuecomment-492603458

Received on Wednesday, 15 May 2019 10:44:49 UTC