- From: Marcos Cáceres <notifications@github.com>
- Date: Fri, 25 Aug 2017 05:22:37 +0000 (UTC)
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/payment-request/issues/594@github.com>
If given:
```JS
const methods = [{ supportedMethods: ["basic-card"] }];
const details = {
total: {
label: "Total due",
amount: { currency: "USD", value: "1.0" },
},
};
const options = {
requestShipping: true,
};
const request = new PaymentRequest(methods, detailsNoShippingOptions, options);
// See below
const response = await request.show();
```
And we do:
```JS
response.onshippingaddresschange = ev =>{
const shippingOptions = [
{
id: "duplicate",
label: "Option",
amount: { currency: "USD", value: "5.00" },
selected: true,
},
{
id: "duplicate",
label: "Option",
amount: { currency: "USD", value: "5.00" },
},
{
id: "not a duplicate",
label: "Option",
amount: { currency: "USD", value: "5.00" },
},
];
const newDetails = {...details, shippingOptions};
ev.updateWith(newDetails);
}
```
The API says that because there are duplicates, all the shippingOptions become invalid and essentially this becomes an error in the payment sheet.
However, the above is developer error, not a user error! This leads to somewhat frustrating user experience where the user is told the merchant can't ship to that address (when in fact, the merchant can!):

I think we should throw on duplicate IDs instead, because the developer screwed up.
--
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/594
Received on Friday, 25 August 2017 05:23:01 UTC