chromium/third_party/blink/renderer/modules/payments/payment_response.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-request/#dom-paymentcomplete

enum PaymentComplete {
    "fail",
    "success",
    "unknown"
};

// https://w3c.github.io/payment-request/#dom-paymentresponse

[
    RuntimeEnabled=PaymentRequest,
    SecureContext,
    Exposed=Window,
    ActiveScriptWrappable
] interface PaymentResponse : EventTarget {
    [CallWith=ScriptState, ImplementedAs=toJSONForBinding] object toJSON();

    readonly attribute DOMString requestId;
    readonly attribute DOMString methodName;
    [CallWith=ScriptState] readonly attribute object details;
    readonly attribute PaymentAddress? shippingAddress;
    readonly attribute DOMString? shippingOption;
    readonly attribute DOMString? payerName;
    readonly attribute DOMString? payerEmail;
    readonly attribute DOMString? payerPhone;

    [CallWith=ScriptState, RaisesException, NewObject] Promise<undefined> complete(optional PaymentComplete paymentResult = "unknown");
    [CallWith=ScriptState, RaisesException, NewObject, Measure] Promise<undefined> retry(optional PaymentValidationErrors errorFields = {});

    attribute EventHandler onpayerdetailchange;
};