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

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support61 Yes551 No No ?
PaymentRequest constructor61 Yes551 No No ?
requestId61 Yes551 No No ?
shippingAddress61 Yes551 No No ?
shippingOption61 Yes551 No No ?
shippingType61 Yes551 No No ?
onshippingaddresschange61 Yes551 No No ?
onshippingoptionchange61 Yes551 No No ?
canMakePayment61 Yes551 No No ?
show61 Yes551 No No ?
abort61 Yes551 No No ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No53 Yes551 No ? ?
PaymentRequest constructor No53 Yes551 No ? ?
requestId No60 Yes551 No ? ?
shippingAddress No53 Yes551 No ? ?
shippingOption No53 Yes551 No ? ?
shippingType No56 Yes551 No ? ?
onshippingaddresschange No53 Yes551 No ? ?
onshippingoptionchange No53 Yes551 No ? ?
canMakePayment No56 Yes551 No ? ?
show No53 Yes551 No ? ?
abort No53 Yes551 No ? ?

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

 Last updated by: fscholz,