Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/386.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 不更改Apple Pay with Payment Request API中的货币_Javascript_Applepay_Payment Request Api - Fatal编程技术网

Javascript 不更改Apple Pay with Payment Request API中的货币

Javascript 不更改Apple Pay with Payment Request API中的货币,javascript,applepay,payment-request-api,Javascript,Applepay,Payment Request Api,我在网站上集成Apple Pay和支付请求API时遇到问题。当用户选择了另一种货币的地址后,Apple Pay sheet不会更新货币,只会更新数字。我正在做这个例子中的更新 session.onshippingaddresschange = event => { update(newAddress).then(data => { const updatedData = { shippingOptions: data.shippingO

我在网站上集成Apple Pay和支付请求API时遇到问题。当用户选择了另一种货币的地址后,Apple Pay sheet不会更新货币,只会更新数字。我正在做这个例子中的更新

session.onshippingaddresschange = event => {
    update(newAddress).then(data => {
        const updatedData = {
            shippingOptions: data.shippingOptions.map(
                (shippingOption, index) => ({
                    id: shippingOption.id,
                    label: shippingOption.name,
                    amount: {
                        value: shippingOption.price,
                        currency: data.currency
                    },
                    selected: index === 0
                })
            ),
            total: {
                label: 'Total',
                amount: {
                    value: data.grandTotal,
                    currency: data.currency
                }
            },
            displayItems: [
                {
                    label: 'Subtotal',
                    amount: {
                        value: data.subTotalAmountExclTaxes,
                        currency: data.currency
                    }
                },
                {
                    label: 'Sales Tax',
                    amount: {
                        value: data.totalTaxes,
                        currency: data.currency
                    }
                },
                {
                    label: 'Shipping',
                    amount: {
                        value: data.totalShippingFee,
                        currency: data.currency
                    }
                }
            ]
        };

        event.updateWith(updatedData);
    });
};