Re: [w3c/payment-method-basic-card] Support for fine-grained request for billing information (#72)

@ianbjacobs and I spoke about this on IRC, and I had a straw-man proposal that extends @marcoscaceres's [proposal](https://github.com/w3c/payment-request/issues/842#issuecomment-469536532) to allow for progressive disclosure of address information in Basic Card.

I don't believe Basic Card currently uses PaymentDetailsUpdate.paymentMethodErrors, but you could imagine a Basic Card error that says "I need more address granularity," which the payment handler handles by re-dispatching the paymentmethodchange event with additional information (if allowed according to the redact list).

Here is how it might work:

```
const basicCardRequest = {
    supportedMethods: 'basic-card',
    data: {
        supportedNetworks: [...],
        requestBillingAddress: ['country'],
    },
};

const details = ...;

const request = new PaymentRequest([basicCardRequest], details);
request.onpaymentmethodchange = (event) => {
    // country is now available in event.methodDetails; all other fields redacted.
    // assume that the merchant detects the country as 'US' and would now like to request the state.
    // this call to updateWith() will result in another paymentmethodchange event with the new requested billing fields.
    event.updateWith({
        paymentMethodErrors: [{
            requestBillingAddress: ['country', 'region'],
        }],
    });
};
```

This assumes that Basic Card is extended to define some sort of `BasicCardError` data structure that allows specifying a new sequence of requested billing address fields.

It's not clear that this would require user consent for each call to updateWith(). User consent would occur when the payment button is clicked, and user agents would never reveal more than allowed by the redact list. Full shipping and billing address information would still require authorizing payment. This would simply allow merchants who opt in to start out requesting as little as possible then iteratively get more specific as needed.

-- 
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-method-basic-card/issues/72#issuecomment-481047780

Received on Monday, 8 April 2019 23:45:49 UTC