PaymentMethodChangeEvent: PaymentMethodChangeEvent() constructor

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 PaymentMethodChangeEvent() constructor creates a new PaymentMethodChangeEvent object providing details about a paymentmethodchange event.

Syntax

js
new PaymentMethodChangeEvent(type)
new PaymentMethodChangeEvent(type, options)

Parameters

type

A string with the name of the event. It is case-sensitive and browsers set it to paymentmethodchange.

options Optional

An object that, in addition of the properties defined in Event(), can have the following properties:

methodName Optional

A string containing the payment method identifier for the payment handler being used. This is an empty string by default.

methodDetails Optional

An object providing payment method-specific information describing the changes made to the payment, or null if there is no additional information available or required. This is null by default.

Return value

A new PaymentMethodChangeEvent object describing a change to the options specified for the payment method given in the methodName property.

The type of the methodDetails property depends on the payment method. For example, if methodName is https://example.com/pay, indicating that the Example Pay payment method is being used for validation, the shape of methodDetails is defined by the payment method.

Specifications

Specification
Payment Request API
# dom-paymentmethodchangeevent-constructor

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
PaymentMethodChangeEvent() constructor

Legend

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

Full support
Full support
No support
No support
User must explicitly enable this feature.

See also