blob: 21608ee8516c79191db816c26eb267dd12269e2b [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://w3c.github.io/payment-handler/#the-paymentrequestevent
[
RuntimeEnabled=PaymentApp,
Constructor(DOMString type, PaymentRequestEventInit eventInitDict),
Exposed=ServiceWorker
] interface PaymentRequestEvent : ExtendableEvent {
readonly attribute USVString topOrigin;
readonly attribute USVString paymentRequestOrigin;
readonly attribute DOMString paymentRequestId;
readonly attribute FrozenArray<PaymentMethodData> methodData;
[CallWith=ScriptState] readonly attribute object total;
readonly attribute FrozenArray<PaymentDetailsModifier> modifiers;
readonly attribute DOMString instrumentKey;
[CallWith=ScriptState, RuntimeEnabled=PaymentHandlerHandlesShippingAndContact] readonly attribute object? paymentOptions;
[RuntimeEnabled=PaymentHandlerHandlesShippingAndContact] readonly attribute FrozenArray<PaymentShippingOption>? shippingOptions;
[CallWith=ScriptState] Promise<WindowClient?> openWindow(USVString url);
[CallWith=ScriptState, RaisesException, RuntimeEnabled=PaymentHandlerChangePaymentMethod] Promise<PaymentRequestDetailsUpdate?> changePaymentMethod(DOMString methodName, optional object? methodDetails = null);
[CallWith=ScriptState, RaisesException] void respondWith(Promise<PaymentResponse> response);
[CallWith=ScriptState, RuntimeEnabled=PaymentHandlerHandlesShippingAndContact] Promise<PaymentRequestDetailsUpdate?> changeShippingAddress(PaymentAddressInit shippingAddress);
[CallWith=ScriptState, RuntimeEnabled=PaymentHandlerHandlesShippingAndContact] Promise<PaymentRequestDetailsUpdate> changeShippingOption(DOMString shippingOption);
};