Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
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 user's 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 Payment Request 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.
Note: The API is available inside cross-origin <iframe>
elements only if they have had the allowpaymentrequest
attribute set on them.
PaymentAddress
PaymentRequest
PaymentRequestEvent
PaymentRequest
is made.PaymentRequestUpdateEvent
PaymentMethodChangeEvent
PaymentResponse
MerchantValidationEvent
AddressErrors
PaymentAddress
entries which have errors.PayerErrors
PaymentResponse
's email, phone, and name attributes.PaymentDetailsUpdate
BasicCardChangeDetails
methodDetails
on the 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
BasicCardResponse
Specification | Status | Comment |
---|---|---|
Payment Request API | Candidate Recommendation | Initial definition. |
Basic Card Payment | Working Draft | Defines BasicCardRequest and BasicCardResponse , among other things needed for handling credit card payment |
Unknown | Unknown | Defines payment method identifiers and how they are validated, and, where applicable, minted and formally registered with the W3C. |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 61
|
Yes | 55
|
No | No | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | No | 53
|
Yes | 55
|
No | ? | 6.0 |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Payment_Request_API