0

我在网站上将 Apple Pay 与 Payment Request API 集成时遇到问题。在用户选择使用另一种货币的地址后,Apple Pay 表不会更新货币,它只会更新数字。我正在做这个例子中的更新。

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);
    });
};
4

0 回答 0