| // 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-request/#paymentrequest-interface |
| // http://crbug.com/587995 |
| |
| [ |
| RuntimeEnabled=PaymentRequest, |
| SecureContext, |
| Exposed=Window, |
| ActiveScriptWrappable |
| ] interface PaymentRequest : EventTarget { |
| [CallWith=ExecutionContext, RaisesException] constructor(sequence<PaymentMethodData> methodData, optional PaymentDetailsInit details = {}, optional PaymentOptions options = {}); |
| [CallWith=ScriptState, RaisesException, NewObject] Promise<PaymentResponse> show(optional Promise<PaymentDetailsUpdate> detailsPromise); |
| [CallWith=ScriptState, RaisesException, NewObject] Promise<void> abort(); |
| [CallWith=ScriptState, RaisesException, HighEntropy, Measure, NewObject] Promise<boolean> canMakePayment(); |
| [CallWith=ScriptState, RaisesException, HighEntropy, Measure, NewObject] Promise<boolean> hasEnrolledInstrument(); |
| |
| readonly attribute DOMString id; |
| [ImplementedAs=getShippingAddress] readonly attribute PaymentAddress? shippingAddress; |
| readonly attribute DOMString? shippingOption; |
| readonly attribute PaymentShippingType? shippingType; |
| |
| attribute EventHandler onshippingaddresschange; |
| attribute EventHandler onshippingoptionchange; |
| [RuntimeEnabled=PaymentMethodChangeEvent] attribute EventHandler onpaymentmethodchange; |
| }; |