PaymentResponse: toJSON() Methode

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

We’d love to hear your thoughts on the next set of proposals for the JavaScript language. You can find a description of the proposals here.
Please take two minutes to fill out our short survey.

Sicherer Kontext: Diese Funktion ist nur in sicheren Kontexten (HTTPS) in einigen oder allen unterstützenden Browsern verfügbar.

Die toJSON() Methode des PaymentResponse Interfaces ist ein Serializer; sie gibt eine JSON-Darstellung des PaymentResponse Objekts zurück.

Syntax

js
toJSON()

Parameter

Keine.

Rückgabewert

Ein JSON-Objekt, das die Serialisierung des PaymentResponse Objekts ist.

Beispiele

Verwenden der toJSON Methode

In diesem Beispiel gibt der Aufruf von paymentResponse.toJSON() eine JSON-Darstellung des PaymentResponse Objekts zurück.

js
payment.show().then((paymentResponse) => {
  console.log(paymentResponse.toJSON());
});

Um eine JSON-Zeichenfolge zu erhalten, können Sie direkt JSON.stringify(paymentResponse) verwenden; dies ruft toJSON() automatisch auf.

Spezifikationen

No specification found

No specification data found for api.PaymentResponse.toJSON.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser-Kompatibilität

Siehe auch