Payment Request API

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The Payment Request API provides a consistent user experience for merchants and users. It is not a new way of paying for things; instead, it's a way for users to select their preferred way of paying for things and make that information available to a merchant.

Concepts and usage

Many problems related to online shopping cart abandonment can be traced to checkout forms, which can be difficult and time-consuming to fill out and often require multiple steps to complete. The Payment Request API is meant to reduce the steps needed to complete payment online, potentially doing away with checkout forms. It aims to make the checkout process more accessible by having payment apps store a user's details, which are passed along to a merchant, hopefully without requiring an HTML form.

To request a payment, a web page creates a PaymentRequest object in response to a user action that initiates a payment, such as clicking a "Purchase" button. The PaymentRequest allows the web page to exchange information with the user agent while the user provides input to complete the transaction.

You can find a complete guide in Using the Payment Request API.

Note: The API is available inside cross-origin <iframe> elements only if they have had the allowpaymentrequest attribute set on them.

Interfaces

PaymentAddress Deprecated Non-standard

An object that contains address information; used for billing and shipping addresses, for example.

PaymentRequest

An object that provides the API for creating and managing the user agent's payment interface.

PaymentRequestUpdateEvent

Enables the web page to update the details of the payment request in response to a user action.

PaymentMethodChangeEvent

Represents the user changing payment instrument (e.g., switching from one payment method to another).

PaymentResponse

An object returned after the user selects a payment method and approves a payment request.

MerchantValidationEvent Deprecated

Represents the browser requiring the merchant (website) to validate themselves as allowed to use a particular payment handler (e.g., registered as allowed to use Apple Pay).

Specifications

Specification
Payment Request API
# paymentrequest-interface

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
PaymentRequest
PaymentRequest() constructor
secure-payment-confirmation method
Experimental
abort()
canMakePayment()
id
merchantvalidation event
Deprecated
paymentmethodchange event
shippingAddress
DeprecatedNon-standard
shippingOption
DeprecatedNon-standard
shippingType
DeprecatedNon-standard
shippingaddresschange event
DeprecatedNon-standard
shippingoptionchange event
DeprecatedNon-standard
show

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
User must explicitly enable this feature.

See also