[w3c/payment-request] Not able to add shipping options for apple pay (#778)

I am having issue in adding shipping options dynamically based on shipping address entered. Below is my test code.

```
let paymentMethod = [
    {
        supportedMethods: "https://apple.com/apple-pay",
        data: {
            version: 3,
            merchantIdentifier: "<merchatn_id>",
            merchantCapabilities: ["supports3DS", "supportsCredit", "supportsDebit"],
            supportedNetworks: ["amex", "discover", "masterCard", "visa"],
            countryCode: "US",
        }
    }
];

let paymentDetails = {
    "currency": "USD",
    "displayItems": [
        {
            label: "Sales Tax",
            amount: {"currency": "USD", "value": "0.1"},
            type: "tax"
        },
        {
            label: "Sub-total",
            amount: {"currency": "USD", "value": "0.1"}
        }
    ],
    total: {
        label: "Total due",
        amount: {"currency": "USD", "value": "0.2"}
    }
};

let options = {
    requestPayerName: true,
    requestPayerEmail: true,
    requestPayerPhone: true,
    requestShipping: true,
    shippingType: "shipping"
};

let paymentRequestObj = new PaymentRequest(paymentMethod, paymentDetails, options);

paymentRequestObj.onmerchantvalidation = (event) => {} //working fine


let addShippingOptions = () => {
    const { shippingOptions, total } = {
        shippingOptions: [
            {
                id: "standard",
                label: "Ground Shipping (2 days)",
                amount: {"currency": "USD", "value": "0.3"},
                selected: true
            },
            {
                id: "drone",
                label: "Drone Express (2 hours)",
                amount: {"currency": "USD", "value": "0.5"}
            }
        ],
        total: {
            label: "Total due",
            amount: {"currency": "USD", "value": "0.5"}
        }
    };

    paymentDetails.displayItems.push({
        label: "Shipping",
        amount: {"currency": "USD", "value": "0.3"}
    });

    return { ...paymentDetails, shippingOptions, total};
}

paymentRequestObj.onshippingaddresschange = (event) => {
    event.updateWith(addShippingOptions());
};
```

when the callback **onshippingaddresschange** gets called, payment sheet gets updated only for **sub-total**, **shipping cost** and **total** fields properly, . But it never display shipping options added to the payment details object in payment sheet. 



-- 
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/778

Received on Tuesday, 18 September 2018 04:27:11 UTC