chromium/third_party/blink/renderer/modules/payments/payment_request_event.idl

// Copyright 2016 The Chromium Authors
// 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,
    Exposed=ServiceWorker
] interface PaymentRequestEvent : ExtendableEvent {
    constructor(DOMString type, PaymentRequestEventInit eventInitDict);
    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] readonly attribute object? paymentOptions;
    readonly attribute FrozenArray<PaymentShippingOption>? shippingOptions;

    [CallWith=ScriptState] Promise<WindowClient?> openWindow(USVString url);
    [CallWith=ScriptState, RaisesException] Promise<PaymentRequestDetailsUpdate?> changePaymentMethod(DOMString methodName, optional object? methodDetails = null);
    [CallWith=ScriptState, RaisesException] void respondWith(Promise<PaymentResponse> response);
    [CallWith=ScriptState, RaisesException] Promise<PaymentRequestDetailsUpdate?> changeShippingAddress(AddressInit shippingAddress);
    [CallWith=ScriptState, RaisesException] Promise<PaymentRequestDetailsUpdate?> changeShippingOption(DOMString shippingOption);
};