Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The PaymentRequest interface of the Payment Request API manages the process of a user making a payment.
Constructor
PaymentRequest()Secure context- Creates a new
PaymentRequestobject.
Properties
PaymentRequest.shippingAddressRead only Secure context- Returns the shipping address chosen by the user. This property is only populated if the constructor is called with the
requestShippingflag set to true. PaymentRequest.shippingOptionRead only Secure context- Returns the ID of the selected shipping option. This property is only populated if the constructor is called with the
requestShippingflag set to true.
Event Handlers
PaymentRequest.onshippingaddresschangeSecure context- Fired whenever the user changes their shipping address.
PaymentRequest.onshippingoptionchangeSecure context- Fired whenever the user changes a shipping option.
Methods
PaymentRequest.canMakePayment()Secure context- Indicates whether the
PaymentRequestobject can make a payment before callingshow().
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. |
Editor's Draft | Initial definition. |
Browser Compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support |
60.0 |
No support[1] | ? | ? | ? |
canMakePayment |
60.0 |
No support[1] | ? | ? | ? |
| Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|
| Basic support | No support | 53.0 | ?[1] | ? | ? | ? | 53.0 |
canMakePayment |
No support |
No support |
?[1] | ? | ? | ? | 56.0 |
[1] Supported since 55 but disabled on all versions. Hidden behind the dom.payments.request.enabled pref.
Document Tags and Contributors
Tags:
Contributors to this page:
chrisdavidmills,
dangerismycat,
Dan-Dascalescu,
jpmedley,
pyoor,
dgashmdn
Last updated by:
chrisdavidmills,