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 support571 ? ? ? No ?
PaymentRequestEvent() constructor571 ? ? ? No ?
instrumentKey602 ? ? ? No ?
methodData602 ? ? ? No ?
modifiers602 ? ? ? No ?
openWindow613 ? ? ? No ?
paymentRequestId602 ? ? ? No ?
paymentRequestOrigin602 ? ? ? No ?
respondWith594 ? ? ? No ?
topOrigin

685

61 — 676

? ? ? No ?
total602 ? ? ? No ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No571 ? ? No ?7.0
PaymentRequestEvent() constructor No571 ? ? No ? No
instrumentKey No602 ? ? No ? No
methodData No602 ? ? No ? No
modifiers No602 ? ? No ? No
openWindow No613 ? ? No ? No
paymentRequestId No602 ? ? No ? No
paymentRequestOrigin No602 ? ? No ? No
respondWith No594 ? ? No ?7.0
topOrigin No

685

61 — 676

? ? No ? No
total No602 ? ? No ? No

1. From version 57: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.

2. From version 60: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.

3. From version 61: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.

4. From version 59: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.

5. From version 68: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.

6. Supported as topLevelOrigin.

Document Tags and Contributors

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