PaymentResponse: toJSON() 方法
toJSON() 方法是 PaymentResponse 介面的一個 序列化器;它返回 PaymentResponse 物件的 JSON 表示形式。
語法
js
toJSON()
引數
無。
返回值
JSON 物件,是 PaymentResponse 物件的序列化結果。
示例
使用 toJSON 方法
在此示例中,呼叫 paymentResponse.toJSON() 將返回 PaymentResponse 物件的 JSON 表示形式。
js
payment.show().then((paymentResponse) => {
console.log(paymentResponse.toJSON());
});
要獲取 JSON 字串,您可以直接使用 JSON.stringify(paymentResponse);它會自動呼叫 toJSON()。
規範
此特性似乎未在任何規範中定義。瀏覽器相容性
載入中…