PaymentRequestEvent

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

PaymentRequestEvent interface of the the 支付请求 API is the object passed to a payment handler when a PaymentRequest is made.

构造函数

PaymentRequestEvent()
创建新的 PaymentRequestEvent 对象。

特性

instrumentKey 只读
返回 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.
methodData 只读
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.
modifiers 只读
Returns an array of objects containing changes to payment details.
paymentRequestId 只读
Returns the ID of the PaymentRequest 对象。
paymentRequestOrigin 只读
Returns the origin where the PaymentRequest object was initialized.
topOrigin 只读
Returns the top-level origin where the PaymentRequest object was initialized.
total 只读
Returns the total amount being requested for payment.

方法

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 .
respondWith()
Prevents the default event handling and allows you to provide a Promise for a PaymentResponse object yourself.

规范

规范 状态 Comment
Payment Handler API
The definition of 'PaymentRequestEvent' in that specification.
工作草案 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
PaymentRequestEvent
Chrome 57
Disabled
57
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 57
Disabled
57
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
PaymentRequestEvent() 构造函数
Chrome 57
Disabled
57
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 57
Disabled
57
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
instrumentKey
Chrome 60
Disabled
60
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 60
Disabled
60
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
methodData
Chrome 60
Disabled
60
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 60
Disabled
60
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
modifiers
Chrome 60
Disabled
60
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 60
Disabled
60
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
openWindow()
Chrome 61
Disabled
61
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 61
Disabled
61
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
paymentRequestId
Chrome 60
Disabled
60
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 60
Disabled
60
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
paymentRequestOrigin
Chrome 60
Disabled
60
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 60
Disabled
60
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
respondWith()</code</a>
Chrome 59
Disabled
59
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 59
Disabled
59
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
topOrigin
Chrome 68
Disabled
68
Disabled
Disabled 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.
不支持 61 — 67
Alternate Name
Alternate Name Uses the non-standard name: topLevelOrigin
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 68
Disabled
68
Disabled
Disabled 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.
不支持 61 — 67
Alternate Name
Alternate Name Uses the non-standard name: topLevelOrigin
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No
total
Chrome 60
Disabled
60
Disabled
Disabled 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.
Edge ≤79
Disabled
≤79
Disabled
Disabled From version ≤79: this feature is behind the #service-worker-payment-apps preference (needs to be set to Enabled ).
Firefox No IE ? Opera No Safari ? WebView Android No Chrome Android 60
Disabled
60
Disabled
Disabled 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.
Firefox Android No Opera Android No Safari iOS ? Samsung Internet Android No

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
用户必须明确启用此特征。
用户必须明确启用此特征。
使用非标名称。