v139 · javascript
securePaymentConfirmationAvailability API
This is a Javascript API to provide an easier way to check if the Secure Payment Confirmation[1] feature is available. Currently, the only way to determine SPC’s availability is to create a PaymentRequest with the required parameters[2], which is clunky and difficult in the case where a developer wants to check for SPC before starting to
concepts
-
Availability Probe
A simple await tells the page whether Secure Payment Confirmation will work for this user. Lets the site decide upstream of constructing a full PaymentRequest.
-
Checkout Router
The motivating scenario: a checkout page reorders payment options based on the availability probe — featuring SPC where it works, hiding it otherwise. Real API + simulated fallback.
-
Router vs Fallback Flow
Side-by-side narration of the v138 flow (attempt → reject → re-render) vs v139 flow (probe → decide → render once). Live button calls
PaymentManager.availability()with three known parameter shapes. -
Payment Method Selection Chain
A cascading availability check: SPC → basic PaymentRequest → HTML form. Each step lights up green or red as the chain runs. A scenario dropdown lets you simulate "SPC available", "SPC unavailable + PR available", and "nothing available", showing which fallback activates and why.
why it shipped
This is a Javascript API to provide an easier way to check if the Secure Payment Confirmation[1] feature is available. Currently, the only way to determine SPC’s availability is to create a PaymentRequest with the required parameters[2], which is clunky and difficult in the case where a developer wants to check for SPC before starting to