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 bydetails.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 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- 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 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. |
Candidate Recommendation | Initial definition. |
Browser Compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 61 | Yes | 551 | No | No | ? |
PaymentRequest constructor | 61 | Yes | 551 | No | No | ? |
requestId | 61 | Yes | 551 | No | No | ? |
shippingAddress | 61 | 15 | 551 | No | No | ? |
shippingOption | 61 | 15 | 551 | No | No | ? |
shippingType | 61 | 15 | 551 | No | No | ? |
onshippingaddresschange | 61 | 15 | 551 | No | No | ? |
onshippingoptionchange | 61 | 15 | 551 | No | No | ? |
canMakePayment | 61 | 16 | 551 | No | No | ? |
show | 61 | 15 | 551 | No | No | ? |
abort | 61 | 15 | 551 | No | No | ? |
id | ? | ? | ? | ? | ? | ? |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | Opera Android | iOS Safari | Samsung Internet |
---|---|---|---|---|---|---|---|
Basic support | No | 53 | Yes | 551 | No | ? | 6.0 |
PaymentRequest constructor | No | 53 | Yes | 551 | No | ? | 6.0 |
requestId | No | 60 | Yes | 551 | No | ? | No |
shippingAddress | No | 53 | Yes | 551 | No | ? | 6.0 |
shippingOption | No | 53 | Yes | 551 | No | ? | 6.0 |
shippingType | No | 56 | Yes | 551 | No | ? | 6.0 |
onshippingaddresschange | No | 53 | Yes | 551 | No | ? | 6.0 |
onshippingoptionchange | No | 53 | Yes | 551 | No | ? | 6.0 |
canMakePayment | No | 56 | Yes | 551 | No | ? | 6.0 |
show | No | 53 | Yes | 551 | No | ? | 6.0 |
abort | No | 53 | Yes | 551 | No | ? | 6.0 |
id | ? | ? | ? | ? | ? | ? | ? |
1. 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.
Document Tags and Contributors
Tags:
Contributors to this page:
fscholz,
jpmedley,
Sebastianz,
libbymc,
chrisdavidmills,
dangerismycat,
Dan-Dascalescu,
pyoor,
dgashmdn
Last updated by:
fscholz,