-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
53 lines (38 loc) · 3.45 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
title: Payment Request API
slug: Web/API/Payment_Request_API
page-type: web-api-overview
browser-compat: api.PaymentRequest
---
{{DefaultAPISidebar("Payment Request API")}}{{securecontext_header}}
The **Payment Request API** provides a consistent user experience for merchants and users. It is not a new way of paying for things; instead, it's a way for users to select their preferred way of paying for things and make that information available to a merchant.
## Concepts and usage
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 steps needed to complete payment online, potentially doing away with checkout forms. It aims to make the checkout process more accessible by having payment apps store a user's details, which are passed along to a merchant, hopefully without requiring an HTML form.
To request a payment, a web page creates a {{domxref("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](/en-US/docs/Web/API/Payment_Request_API/Using_the_Payment_Request_API).
> **Note:** The API is available inside cross-origin {{htmlelement("iframe")}} elements only if they have had the [`allowpaymentrequest`](/en-US/docs/Web/HTML/Element/iframe#allowpaymentrequest) attribute set on them.
## Interfaces
- {{domxref('PaymentAddress')}} {{Deprecated_Inline}} {{Non-standard_Inline}}
- : An object that contains address information; used for billing and shipping addresses, for example.
- {{domxref('PaymentRequest')}}
- : An object that provides the API for creating and managing the {{Glossary("user agent", "user agent's")}} payment interface.
- {{domxref('PaymentRequestUpdateEvent')}}
- : Enables the web page to update the details of the payment request in response to a user action.
- {{domxref('PaymentMethodChangeEvent')}}
- : Represents the user changing payment instrument (e.g., switching from one payment method to another).
- {{domxref('PaymentResponse')}}
- : An object returned after the user selects a payment method and approves a payment request.
- {{domxref('MerchantValidationEvent')}} {{Deprecated_Inline}}
- : 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).
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- [Using the Payment Request API](/en-US/docs/Web/API/Payment_Request_API/Using_the_Payment_Request_API)
- [Payment processing concepts](/en-US/docs/Web/API/Payment_Request_API/Concepts)
- [Introducing the Payment Request API for Apple Pay](https://webkit.org/blog/8182/introducing-the-payment-request-api-for-apple-pay/)
- [Google Pay API PaymentRequest Tutorial](https://developers.google.com/pay/api/web/guides/paymentrequest/tutorial)
- [Samsung Pay Web Payments Integration Guide](https://developer.samsung.com/internet/android/web-payments-integration-guide.html)
- [W3C Payment Request API FAQ](https://github.com/w3c/payment-request-info/wiki/FAQ)
- Permissions Policy directive {{httpheader("Permissions-Policy/payment", "payment")}}