The API requires "playing ping pong" with the UI by continuously updating the "details" of a payment request. This means that details either needs to be curried, constantly passed around, or (parents, please, avert your children's eyes) set as a global! 🙀
As such, we should consider adding a convenience method to pull the latest derived "details" from a payment request.
Something like:
```JS
request.onshippingoptionchange = function (ev) {
const details = this.getDetails();
ev.updateWith({ ...details, total: updateTotal(this.shippingOption) });
};
request.onshippingaddresschange = function (ev) {
const details = this.getDetails();
ev.updateWith({ ...details, total: updateTotal(this.shippingAddress) });
};
```
--
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/issues/592