with the W3C is built around an object called PaymentRequest. » The goal is to replace checkout forms with a uniform piece of browser interface that is connected to an internal store of payment information » It is intended to connect to a wide variety of payment methods including PayPal, but currently is only implemented for credit cards and Android Pay.
supportedInstruments is a list of the accepted payment methods » details describes the order, including line items and shipping options » options is an object that configures which of the optional features of the payment sheet are enabled.
billing address if appropriate. This is the only piece of information we must request. » Shipping address and choice of shipping method. » Email Address » Phone Number
the simplest way to make use of Web Payments » While simple, this approach allows requests for payment details, email addresses, and phone numbers. » Shipping information generally requires a more complex approach, as the order details may need to change in response.
shipping options and line items by shipping address, allowing applications like: » higher shipping rates for distant locations like Alaska » sales tax line items that vary by state/province » indicating that a given address is not within the vendors shipping regions » This comes at the cost of having to manage the details object manually.
API requires the user to manage the details object manually, adding complexity. » The three arguments for the PaymentRequest constructor are also divided somewhat artificially, making it useful to construct a single input for the request. » The payments wrapper I have developed contains its own handlers for the payment events, and logic to update details in the most common case.
the previous conditions, we re-generate the object on every change. » The details object is then a pure function of the input object and a state object maintained in the buildRequest closure » The state is treated as immutable with any changes being applied in a copy. » This makes the code much easier to reason about, much as React does for HTML.
displayed line items as shipping options and tax rates change. » It allows rejection of unsupported addresses (e.g. reject all non-US addresses if the vendor only ships within the US) » It allows user-configured variations of shipping method with address. » The input is a single, simpler object that better matches the form in which we receive data.
to revamp the web checkout process. » It is in production as of Chrome 53 but is not yet finalized » The API is modern but low-level » I have developed a high-level wrapper that reduces the need for boilerplate code in a Web Payments implementation.