PaymentManager

Khả dụng hạn chế

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.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Giao diện PaymentManager của Web-based Payment Handler API được sử dụng để quản lý các khía cạnh khác nhau của chức năng ứng dụng thanh toán.

Nó được truy cập thông qua thuộc tính ServiceWorkerRegistration.paymentManager.

Thuộc tính phiên bản

userHint Thử nghiệm

Cung cấp gợi ý cho trình duyệt hiển thị cùng với tên và biểu tượng của ứng dụng thanh toán trong giao diện Web-based Payment Handler.

Phương thức phiên bản

enableDelegations() Thử nghiệm

Ủy thác trách nhiệm cung cấp các phần khác nhau của thông tin thanh toán cần thiết cho ứng dụng thanh toán thay vì thu thập từ trình duyệt (ví dụ: qua tự động điền).

Ví dụ

js
navigator.serviceWorker.register("serviceworker.js").then((registration) => {
  registration.paymentManager.userHint = "Card number should be 16 digits";

  registration.paymentManager
    .enableDelegations(["shippingAddress", "payerName"])
    .then(() => {
      // …
    });

  // …
});

Thông số kỹ thuật

Thông số kỹ thuật
Web-based Payment Handler API
# paymentmanager-interface

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

Xem thêm