The toJSON() method of the PaymentResponse interface is a serializer; it returns a JSON representation of the PaymentResponse object.
A JSON object that is the serialization of the PaymentResponse object.
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.