W3cubDocs

/DOM

PaymentRequest

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The PaymentRequest interface of the Payment Request API is the primary access point into the API, and lets web content and apps accept payments from the end user.

Constructor

PaymentRequest() Secure context
Creates a new PaymentRequest object.

Properties

PaymentRequest.id Read only Secure context
An unique identifier for a particular PaymentRequest, which can be set via details.id. When none is set, it defaults to a UUID.
PaymentRequest.shippingAddress Read only Secure context
If requested via payment options, returns the shipping address chosen by the user for the purposes of calculating shipping. This property is only populated if the constructor is called with the requestShipping flag set to true. Additionally, in some browsers, the parts of the address will be redacted for privacy until the user indicates they are ready to complete the transaction (i.e., they hit "Pay").
PaymentRequest.shippingOption Read only Secure context
Returns the identifier of the selected shipping option. This property is only populated if the constructor is called with the requestShipping flag set to true.
PaymentRequest.shippingType Read only Secure context
Returns the type of shipping used to fulfill the transaction. This will be one of shipping, delivery, pickup, or null if a value was not provided in the constructor.

Event handlers

PaymentRequest.onshippingaddresschange Secure context
Dispatched whenever the user changes their shipping address.
PaymentRequest.onshippingoptionchange Secure context
Dispatched whenever the user changes a shipping option.
PaymentRequest.onpaymentmethodchange Secure context
With some payment handlers (e.g., Apple Pay), dispatched whenever the user changes payment instrument, like switching from a credit card to a debit card.
PaymentRequest.onmerchantvalidation Secure context
With some payment handlers (e.g., Apple Pay), this event handler is called to handle the merchantvalidation event, which is dispatched when the user agent requires that the merchant validate that the merchant or vendor requesting payment is legitimate.

Methods

PaymentRequest.canMakePayment() Secure context
Indicates whether the PaymentRequest object can make a payment before calling show().
PaymentRequest.show() Secure context
Causes the user agent to begin the user interaction for the payment request.
PaymentRequest.abort() Secure context
Causes the user agent to end the payment request and to remove any user interface that might be shown.

Specifications

Specification Status Comment
Payment Request API
The definition of 'PaymentRequest' in that specification.
Candidate Recommendation Initial definition.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
PaymentRequest() constructor 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
abort 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
15 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
canMakePayment 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
16 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
id 60
Disabled
60
Disabled
Disabled From version 60: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
? ? ? ? ?
onpaymentmethodchange No ? 63
Disabled
63
Disabled
Disabled From version 63: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
onshippingaddresschange 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
15 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
onshippingoptionchange 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
15 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
paymentAddress 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
15 55
Disabled
55
Disabled
Uses the non-standard name: shippingAddress
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
requestId No Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
shippingOption 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
15 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
shippingType 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
15 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
show 61
Disabled
61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
15 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support No 53
Disabled
53
Disabled
Disabled From version 53: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? 6.0
PaymentRequest() constructor No 53
Disabled
53
Disabled
Disabled From version 53: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? 6.0
abort No 53
Disabled
53
Disabled
Disabled From version 53: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? 6.0
canMakePayment No 56
Disabled
56
Disabled
Disabled From version 56: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? 6.0
id ? 60
Disabled
60
Disabled
Disabled From version 60: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
? ? ? ? ?
onpaymentmethodchange No No ? 63
Disabled
63
Disabled
Disabled From version 63: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? ?
onshippingaddresschange No 53
Disabled
53
Disabled
Disabled From version 53: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? 6.0
onshippingoptionchange No 53
Disabled
53
Disabled
Disabled From version 53: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? 6.0
paymentAddress No 53
Disabled
53
Disabled
Disabled From version 53: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Uses the non-standard name: shippingAddress
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? 6.0
requestId No No Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? No
shippingOption No 53
Disabled
53
Disabled
Disabled From version 53: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? 6.0
shippingType No 56
Disabled
56
Disabled
Disabled From version 56: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No ? 6.0
show No 53
Disabled
53
Disabled
Disabled From version 53: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Yes 55
Disabled
55
Disabled
Disabled From version 55: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
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/PaymentRequest