Javascript 不更改Apple Pay with Payment Request API中的货币
我在网站上集成Apple Pay和支付请求API时遇到问题。当用户选择了另一种货币的地址后,Apple Pay sheet不会更新货币,只会更新数字。我正在做这个例子中的更新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
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);
});
};