Re: [w3c/payment-request] Support requesting billing address (#749)

@rsolomakhin I think you are right but I'm not sure if that is ALWAYS true.

What if I pick a payment handler that has multiple underlying instruments? If we de-couple this we open up the possibility of allowing payment handlers to explicitly fire this event.

e.g. I pick BobPay which has two different instruments internally.
- Browser fires `paymentmethodchanged` event to signal the selection of BobPay
(Sidebar: Does this event still need an `updateWith()` if it doesn't signal address changes?)
- Inside the BobPay payment handler I select instrument 1
- Payment Handler calls a new synchronous `billingAddressChanged(address)` method
- Browser fires `billingaddresschanged` event
- Website calls `updateWith` with updated VAT and total
- Payment handler gets new payment details as response to calling `billingAddressChanged(address)`
- Inside the BobPay payment handler I select instrument 2
- Payment Handler calls `billingAddressChanged(address)` method again
- Browser fires `billingaddresschanged` event
- Website calls `updateWith` with updated VAT and total
- Payment handler gets new payment details as response to calling `billingAddressChanged(address)`
- etc

If the payment handler never calls 'billingAddressChanged()' then the browser can still fire the `billingaddresschanged` event when the payment handler returns (but before passing the response to the website). In this case, if the website returns with a new total the browser knows that the payment needs to be retried with the payment handler (some design work to figure out how that would be dealt with).

We could consider s similar mechanism for shipping address



-- 
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/749#issuecomment-415876834

Received on Friday, 24 August 2018 20:42:14 UTC