PaymentResponse: toJSON()-Methode

Limited availability

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

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

Verwendung 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 einen JSON-String zu erhalten, können Sie direkt JSON.stringify(paymentResponse) verwenden; diese Funktion wird toJSON() automatisch aufrufen.

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

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
toJSON()

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
User must explicitly enable this feature.

Siehe auch