付款请求 API:获取买家地址

Payment Request API: Getting the buyer's address

我目前正在研究 W3C Payment Request API 作为新电子商务结账流程项目的一部分(主要是为了支持使用 Apple Pay 和 Google Pay 更快地结账)。

从 API 规范的变更历史来看,今年早些时候制定的 this change 似乎不再支持通过付款请求请求买家地址。我们的支付服务提供商的文档仍然显示此选项,目前似乎可以使用。话虽如此,我不想依赖浏览器可能很快就会开始放弃的功能,因为它不再符合标准,会破坏我们的结帐流程。

有谁知道是否有推荐的新方法通过 API 来处理这个问题,或者是否建议将买家的账单和送货地址的集合移回我们页面上的表格甚至使用付款请求时 API?

就付款请求API而言,我认为主要有三个选项:

  • 苹果支付
  • Google 支付
  • basic-card

如您所见,basic-card 已被弃用 (https://blog.chromium.org/2021/10/sunsetting-basic-card-payment-method-in.html),因此您可能希望避免使用此选项。

Apple Pay 和 Google Pay 都提供对帐单和送货地址的访问权限,并且可以作为付款请求中的付款方式访问 API,并且都提供自己的替代方法 APIs (Apple Pay JS API and Google Pay Online API).

我不知道 Apple Pay,但 Google Pay 的建议是使用 Google Pay Online API(它在可用时使用付款请求 API)。 Google Pay 为支持和不支持支付请求 API 的浏览器提供一致的 API。

Does anyone know if there is a recommended new way to handle this via the API, or if it is advisable to move the collection of the buyer's billing and shipping addresses back to a form on our page even when using the payment request API?

Google 付款的指导是place the Google Pay button above manual entry fields and to collect shipping information from Google Pay,这样用户就可以在意识到有更快的结账选项可用之前开始填写表格。

因此,为选择使用它的用户优先考虑数字结账选项,并利用来自数字钱包 API 的 billing/shipping 信息。为无法访问或选择不使用其他支付选项的用户提供手动表单域(建议表单域也正确使用自动填充属性)。

可用的演示站点:https://paydemo.withgoogle.com

仅供参考,如果您希望将 Google Pay 集成到您的网站并使用 JavaScript 框架,请考虑使用 Google Pay 中的框架特定组件,以便于集成: https://github.com/google-pay/google-pay-button