From ccb85c91fc14b121084d2ffc2c9000c43ffc299b Mon Sep 17 00:00:00 2001
From: Stephen McGruer
Date: Thu, 13 Nov 2025 09:13:36 +0900
Subject: [PATCH] Allow payment handlers to report back errors via Payment
Request API
See https://github.com/w3c/payment-request/issues/1040
---
index.html | 66 ++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 59 insertions(+), 7 deletions(-)
diff --git a/index.html b/index.html
index 47da9919..c1f2d3ce 100644
--- a/index.html
+++ b/index.html
@@ -1317,10 +1317,11 @@
- The |acceptPromise| will later be resolved or rejected by either
- the user accepts the payment request algorithm or the
- user aborts the payment request algorithm, which are
- triggered through interaction with the user interface.
+ The |acceptPromise| will later be resolved or rejected by
+ the user accepts the payment request algorithm, the
+ user aborts the payment request algorithm (which are
+ triggered through interaction with the user interface), or
+ the payment handler indicates an internal error algorithm.
If |document| stops being [=Document/fully active=] while the
@@ -2599,9 +2600,10 @@
Return |retryPromise|.
The |retryPromise| will later be resolved by the user accepts
- the payment request algorithm, or rejected by either the
- user aborts the payment request algorithm or abort the
- update.
+ the payment request algorithm, or rejected by the user
+ aborts the payment request algorithm, abort the update,
+ or the payment handler indicates an internal error
+ algorithm.
@@ -3946,6 +3948,56 @@
+
+
+ Payment handler indicates an internal error algorithm
+
+
+ The payment handler indicates an internal error algorithm
+ runs when the payment handler that the user has selected reports an
+ internal error to the user agent. It MUST queue a task on the
+ user interaction task source to perform the following steps:
+
+
+ - Let |request:PaymentRequest| be the {{PaymentRequest}} object
+ that the user is interacting with.
+
+ - If |request|.{{PaymentRequest/[[state]]}} is not
+ "[=PaymentRequest/interactive=]", then terminate this algorithm and
+ take no further action.
+
+ - Set |request|.{{PaymentRequest/[[state]]}} to
+ "[=PaymentRequest/closed=]".
+
+ - Set |request|'s payment-relevant browsing context's
+ payment request is showing boolean to false.
+
+ - Let |error| be an {{"OperationError"}} {{DOMException}}.
+
+ - Let |response:PaymentResponse| be
+ |request|.{{PaymentRequest/[[response]]}}.
+
+ - If |response| is not null:
+
+ - Set |response|.{{PaymentResponse/[[complete]]}} to true.
+
+ - Assert: |response|.{{PaymentResponse/[[retryPromise]]}} is
+ not null.
+
+ - Reject |response|.{{PaymentResponse/[[retryPromise]]}} with
+ |error|.
+
+
+
+ - Otherwise, reject |request|.{{PaymentRequest/[[acceptPromise]]}}
+ with |error|.
+
+ - Abort the current user interaction and close down any remaining
+ user interface.
+
+
+
+
Update a PaymentRequest's details algorithm