PaymentRequestEvent

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The PaymentRequestEvent interface of the the Payment Request API is the ojbect passed to a payment handler when a PaymentRequest is made.

Constructor

PaymentRequestEvent()
Creates a new PaymentRequestEvent object.

Properties

PaymentRequestEvent.instrumentKeyRead only
Returns a PaymentInstrument object reflecting the payment instrument selected by the user or an empty string if the user has not registered or chosen a payment instrument.
PaymentRequestEvent.methodDataRead only
Returns an array of PaymentMethodData objects containing payment method identifers for the payment methods that the web site accepts and any associated payment method specific data.
PaymentRequestEvent.modifiersRead only
Returns an array of objects containing changes to payment details.
PaymentRequestEvent.paymentRequestIdRead only
Returns the ID of the PaymentRequest object.
PaymentRequestEvent.paymentRequestOriginRead only
Returns the origin where the PaymentRequest object was initialized.
PaymentRequestEvent.topLevelOriginRead only
Returns the top-level origin where the PaymentRequest object was initialized.
PaymentRequestEvent.totalRead only
Returns the total amount being requested for payment.

Methods

PaymentRequestEvent.openWindow()
Opens the specified URL in a new window, if and only if the given URL is on the same origin as the calling page. It returns a Promise that resolves with a reference to a WindowClient.
PaymentRequestEvent.respondWith()
Prevents the default event handling and allows you to provide a Promise for a PaymentResponse object yourself.

Specifications

Specification Status Comment
Payment Handler API
The definition of 'PaymentRequestEvent' in that specification.
Working Draft Initial definition.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support611 ? ? ? No ?
PaymentRequestEvent() constructor611 ? ? ? No ?
instrumentKey611 ? ? ? No ?
methodData611 ? ? ? No ?
modifiers611 ? ? ? No ?
openWindow611 ? ? ? No ?
paymentRequestId611 ? ? ? No ?
paymentRequestOrigin611 ? ? ? No ?
respondWith611 ? ? ? No ?
topLevelOrigin611 ? ? ? No ?
total611 ? ? ? No ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No572 ? ? No ?7.0
PaymentRequestEvent() constructor No611 ? ? No ? No
instrumentKey No603 ? ? No ? No
methodData No603 ? ? No ? No
modifiers No603 ? ? No ? No
openWindow No611 ? ? No ? No
paymentRequestId No603 ? ? No ? No
paymentRequestOrigin No603 ? ? No ? No
respondWith No572 ? ? No ?7.0
topLevelOrigin No603 ? ? No ? No
total No603 ? ? No ? No

1. From version 61: this feature is behind the service-worker-payment-apps preference. To change preferences in Chrome, visit chrome://flags.

2. From version 57: this feature is behind the service-worker-payment-apps preference. To change preferences in Chrome, visit chrome://flags.

3. From version 60: this feature is behind the service-worker-payment-apps preference. To change preferences in Chrome, visit chrome://flags.

Document Tags and Contributors

Contributors to this page: jpmedley
Last updated by: jpmedley,