W3cubDocs

/DOM

PaymentRequest

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

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The PaymentRequest interface of the Payment Request API manages the process of a user making a payment.

Constructor

PaymentRequest() Secure context
Creates a new PaymentRequest object.

Properties

PaymentRequest.requestId Read only Secure context
Returns the free-form identifier supplied by the PaymentResponse() constructor by details.id.
PaymentRequest.shippingAddress Read only Secure context
Returns the shipping address chosen by the user. This property is only populated if the constructor is called with the requestShipping flag set to true.
PaymentRequest.shippingOption Read only Secure context
Returns the ID of the selected shipping option. This property is only populated if the constructor is called with therequestShipping 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
Fired whenever the user changes their shipping address.
PaymentRequest.onshippingoptionchange Secure context
Fired whenever the user changes a shipping option.

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 Compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support

61

(Yes) No support[1] ? No support ?
canMakePayment

61

(Yes) No support[1] ? No support ?
id

61

(Yes) No support ? No support ?
shippingType

61

? No support ? No support ?
Feature Android Webview Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support 53 (Yes) ?[1] ? No support ?
canMakePayment No support 56 (Yes) ?[1] ? No support ?
id No support 60 (Yes) ? ? No support ?
shippingType No support

56

? ? ? No support ?

[1] Supported since 55 but disabled on all versions. Hidden behind the dom.payments.request.enabled pref.

© 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