PaymentResponse: toJSON() method
The toJSON() method of the PaymentResponse interface is a serializer; it returns a JSON representation of the PaymentResponse object.
Syntax
Parameters
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
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
toJSON |
60 |
15 |
55 |
No |
47 |
11.1 |
No |
55 |
No |
42 |
11.3 |
6.0 |
See also