PaymentRequestEvent: thuộc tính total

Limited availability

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

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Note: This feature is only available in Service Workers.

Thuộc tính chỉ đọc total của giao diện PaymentRequestEvent trả về một đối tượng PaymentCurrencyAmount chứa tổng số tiền được yêu cầu để thanh toán.

Giá trị

Một đối tượng PaymentCurrencyAmount. Đối tượng này chứa các thuộc tính sau:

currency

Một chuỗi chứa mã tiền tệ theo chuẩn ISO 4217 gồm ba chữ cái biểu thị loại tiền tệ của khoản thanh toán. Ví dụ bao gồm USD, CANGBP.

value

Một chuỗi chứa giá trị tiền tệ thập phân, ví dụ: 2.55.

Ví dụ

js
self.addEventListener("paymentrequest", (e) => {
  console.log(e.total);
});

Thông số kỹ thuật

Specification
Web-based Payment Handler API
# dom-paymentrequestevent-total

Tương thích trình duyệt

Xem thêm