- From: Matt N. <notifications@github.com>
- Date: Thu, 07 Dec 2017 05:45:01 +0000 (UTC)
- To: w3c/payment-request <payment-request@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/payment-request/issues/647/349869305@github.com>
An alternative approach to allowing the user to retry a payment without introducing a new method would be to use an event like Apple Pay's `onpaymentauthorized` but implementing the `PaymentRequestAuthorizedEvent` interface: ```webidl interface PaymentRequestAuthorizedEvent : PaymentRequestUpdateEvent { readonly attribute PaymentResponse response; }; ``` `errorFields` would still be added to `PaymentDetailsUpdate` to be used by `onpaymentauthorized`'s `updateWith` method to specify errors (field-specific and otherwise) with the same `PaymentError` interface as previous proposal. An author responds to `onpaymentauthorized` with either an `updateWith` to allow the user to retry with some errors or by calling `response.complete()` to close the request UI. ```js request.onpaymentauthorized = function(event) { let errorFields = checkResponse(event.response); if (errors.length) { event.updateWith(Promise.resolve({ details, errorFields, })); } else { const status = processPayment(response); event.response.complete(status); } } ``` This approach feels more natural to me than getting a new `Promise` from each `.retry(…)` and provides a single way to provide `PaymentError`s, rather than `updateWith` + `retry`. Just my two cents. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/payment-request/issues/647#issuecomment-349869305
Received on Thursday, 7 December 2017 05:46:16 UTC