安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
The Payment Request API provides a consistent user experience for both merchants and users. It is not a new way for paying for things; rather, it's a way for users to select their preferred way of paying for things, and make that information available to a merchant.
Many problems related to online shopping-cart abandonment can be traced to checkout forms, which can be difficult and time consuming to fill out and often require multiple steps to complete. The 支付请求 API is meant to reduce the number of steps needed to complete a payment online, potentially doing away with checkout forms. It aims to make the checkout process easier, by remembering a user's details, which are then passed along to a merchant hopefully without requiring a HTML form.
Advantages of using the Payment Request API with "basic-card" (card-based payments):
To request a payment, a web page creates a
PaymentRequest
object in response to a user action that initiates a payment, such as clicking a "Purchase" button. The
PaymentRequest
allows the web page to exchange information with the user agent while the user provides input to complete the transaction.
You can find a complete guide in Using the Payment Request API .
注意
: The API is available inside cross-origin
<iframe>
elements only if they have had the
allowpaymentrequest
attribute set on them.
PaymentAddress
An object that contains address information; used for billing and shipping addresses, for example.
PaymentRequest
PaymentRequestEvent
PaymentRequest
is made.
PaymentRequestUpdateEvent
Enables the web page to update the details of the payment request in response to a user action.
PaymentMethodChangeEvent
Represents the user changing payment instrument (e.g., switching from a credit card to debit card).
PaymentResponse
An object returned after the user selects a payment method and approves a payment request.
MerchantValidationEvent
Represents the browser requiring the merchant (website) to validate themselves as allowed to use a particular payment handler (e.g., registered as allowed to use Apple Pay).
AddressErrors
PaymentAddress
entries which have errors.
PayerErrors
PaymentResponse
's email, phone, and name attributes.
PaymentDetailsUpdate
An object describing changes that need to be made to the payment details in the event that the server needs to update information following the instantiation of the payment interface but before the user begins to interact with it.
BasicCardChangeDetails
methodDetails
在
paymentmethodchange
event sent to the
PaymentRequest
when the user changes payment information.
BasicCardErrors
BasicCardResponse
object that are not valid. This is used as the value of the
paymentMethod
property on the
PaymentValidationErrors
object sent to the
PaymentRequest
when an error occurs.
BasicCardRequest
Defines an object structure for containing payment request details such as card type.
BasicCardResponse
Defines an object structure for payment response details such as the number/expiry date of the card used to make the payment, and the billing address.
| 规范 | 状态 | 注释 |
|---|---|---|
| 支付请求 API | 候选推荐 | 初始定义。 |
| Basic Card Payment | 工作草案 |
定义
BasicCardRequest
and
BasicCardResponse
, among other things needed for handling credit card payment
|
| Payment Method Identifiers | 候选推荐 | Defines payment method identifiers and how they are validated, and, where applicable, minted and formally registered with the W3C. |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
PaymentRequest
|
Chrome 61 | Edge ≤18 |
Firefox
55
Disabled
|
IE 不支持 No | Opera 不支持 No | Safari 11.1 | WebView Android 不支持 No | Chrome Android 53 |
Firefox Android
55
Disabled
|
Opera Android 不支持 No | Safari iOS 11.3 | Samsung Internet Android 6.0 |
完整支持
不支持
见实现注意事项。
用户必须明确启用此特征。
payment