Bug 219254 - Update promise doesn't update the currency
Summary: Update promise doesn't update the currency
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Safari 14
Hardware: Mac macOS 10.15
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2020-11-23 04:50 PST by Dmitry Kochnev
Modified: 2021-09-07 10:39 PDT (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Kochnev 2020-11-23 04:50:13 PST
According to the docs — https://www.w3.org/TR/payment-request/#paymentdetailsupdate-dictionary — I can fetch a new total (amount and currency) if I need it. But there is a problem — the sum is updated, but the currency is not, and I end up with an incorrect payment request.

Use case / steps to reproduce:
1. I call PaymentRequest.show(fetchItemsFromServer) with a stub total like { amount: "0.00", currency: "USD" }. Because of the design of my system, I need to register each payment attempt in the payment service at the moment when a user clicks on the checkout button, then the service gives me exact settings like allowed card networks, tokenization specification, total amount and currency. 
2. I fetch order items and the total from the server like { amount: "100.00", currency: "RUB" }.
3. I end up with payment request containing { amount "100.00", currency: "USD" }. The amount is received from the server, and the currency is stuck from the stub.

Exact version of safari: 14.0.1 (16610.
Comment 1 Radar WebKit Bug Importer 2020-11-30 04:51:15 PST
Comment 2 Pierre-Olivier Blouin 2021-09-07 10:10:33 PDT

Could we have a timeline on this or maybe if you need more details in order to fix it?

I have the exact same issue, the currency won't update when you call updateWith() with a new currency.

Comment 3 Pierre-Olivier Blouin 2021-09-07 10:39:27 PDT
Adding to my previous comment, this makes the feature unusable for context where you land on a page that is in a certain country and then your shipping address is in a different country.

The expected behaviour would be:

PaymentRequest is initiated with the item to purchase and the currency is USD
The user initiates the Apple Pay payment, his shipping address is in Canada, then updateWith() is called and everything gets updated to CAD

Problem now, is that the payment data returned by Apple Pay is always in the first currency that was selected.

We use PayEasy to process the payment and we got this error: `Error(s) returned in Apple Pay authorize response: [{"code":"400","description":"Bad Request (95) - Invalid Currency Requested"}]`

Which makes sense because I want to purchase in CAD, but the request was encoded with USD for its currency.