web api instance method
PaymentResponse: toJSON() method
Secure context
The toJSON() method of the PaymentResponse interface is a serializer; it returns a JSON representation of the PaymentResponse object.
Syntax
toJSON()
Parameters
None.
Return value
A JSON object that is the serialization of the PaymentResponse object.
Examples
Using the toJSON method
In this example, calling paymentResponse.toJSON() returns a JSON representation of the PaymentResponse object.
payment.show().then((paymentResponse) => {
console.log(paymentResponse.toJSON());
});
To get a JSON string, you can use JSON.stringify(paymentResponse) directly; it will call toJSON() automatically.
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.