PaymentRequestEvent()
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The PaymentRequestEvent
constructor creates a new
PaymentRequestEvent
object which is a constructor for a
PaymentRequestEvent
which is the object passed to a payment handler when
a PaymentRequest
is made.
Syntax
new PaymentRequestEvent(type)
new PaymentRequestEvent(type, options)
Parameters
type
-
A string with the name of the event. It is case-sensitive and browsers set it to
paymentrequest
. options
Optional-
An object that, in addition of the properties defined in
ExtendableEvent()
, can have the following properties:instrumentKey
-
A
PaymentInstrument
object reflecting the payment instrument selected by the user or an empty string if the user has not registered or chosen a payment instrument. methodData
-
An array of
PaymentMethodData
objects containing payment method identifiers for the payment methods that the web site accepts and any associated payment method specific data. modifiers
-
An array of objects containing changes to payment details.
paymentRequestId
-
The ID of the
PaymentRequest
object. paymentRequestOrigin
-
The origin where the
PaymentRequest
object was initialized. topOrigin
-
The top-level origin where the
PaymentRequest
object was initialized. total
-
The total amount being requested for payment.
Return value
A new PaymentRequestEvent
object.
Specifications
Specification |
---|
Payment Handler API # dom-paymentrequestevent-constructor |
Browser compatibility
BCD tables only load in the browser