Bug 219254

Summary: Update promise doesn't update the currency
Product: WebKit Reporter: Dmitry Kochnev <aurokkez>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: aestes, p-o.blouin, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: Mac   
OS: macOS 10.15   

Dmitry Kochnev
Reported 2020-11-23 04:50:13 PST
Hello! 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.2.11.51.8).
Attachments
Radar WebKit Bug Importer
Comment 1 2020-11-30 04:51:15 PST
Pierre-Olivier Blouin
Comment 2 2021-09-07 10:10:33 PDT
Hi! 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. Thanks
Pierre-Olivier Blouin
Comment 3 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.
Note You need to log in before you can comment on or make changes to this bug.