PaymentHandlerAppError interface
- Category
- JavaScript
- Type
- New or changed feature
- Status
- Proposed (Chrome Proposed)
- Intent stage
- None
Summary
Allows payment handlers to return structured error codes via the PaymentHandlerAppError interface, which extends DOMException. When a web-based payment handler rejects the promise passed to PaymentRequestEvent's respondWith() method with a PaymentHandlerAppError (or a native payment app reports an equivalent structured error), the browser rejects the promise returned by PaymentRequest's show() method with a PaymentHandlerAppError. This helps merchant sites distinguish between failure categories such as unsupported users, merchant configuration issues, temporary service outages, and internal payment app errors so they can show tailored recovery flows or log actionable diagnostics.
Motivation
When a payment handler fails to complete a transaction, the merchant site invoking PaymentRequest.show() often needs to understand why the transaction failed so it can respond appropriately (e.g., offering alternative checkout rails, displaying merchant-actionable error messages, or logging incident correlation IDs). Issue #1040 (https://github.com/w3c/payment-request/issues/1040) added the ability for payment handlers to indicate internal app error (throwing an OperationError) as a distinct failure state from user cancel (which throws AbortError). However, this does not allow payment handlers any method to communicate details or differentiate between different types of internal app errors. When a payment app encounters an unrecoverable failure and must close, the web layer (the merchant's checkout page or an embedded payment provider SDK) serves as the primary session coordinator, needing structured context to show the right follow-up to the user, know whether an error is temporary (worth retrying) or permanent for that session, update fallback flows without waiting for native app-store release cycles, and distinguish expected user drop-offs from real platform crashes in website telemetry.
Standards & signals
- Firefox: No signal
- Safari: No signal
- Web developers: No signals
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=paymenthandlerapperror-interface
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+PaymentHandlerAppError%20interface
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=PaymentHandlerAppError%20interface
- Baseline status: https://webstatus.dev/?q=PaymentHandlerAppError%20interface