Table of Contents

Class PaymentRequestEvent

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll
NOTE
Experimental
The PaymentRequestEvent interface of the {{domxref("Payment Handler API", "", "", "nocode")}} is the object passed to a payment handler when a PaymentRequest is made.
[Value("PaymentRequestEvent")]
public class PaymentRequestEvent : ExtendableEvent
Inheritance
PaymentRequestEvent
Inherited Members

Remarks

Constructors

PaymentRequestEvent()

public PaymentRequestEvent()

PaymentRequestEvent(string, PaymentRequestEventInit)

NOTE
Experimental
The PaymentRequestEvent constructor creates a new PaymentRequestEvent object instance.
public PaymentRequestEvent(string type, PaymentRequestEventInit eventInitDict = null)

Parameters

type string
eventInitDict PaymentRequestEventInit

Remarks

Properties

MethodData

NOTE
Experimental
The methodData read-only property of the
PaymentRequestEvent interface returns an array of
PaymentMethodData objects containing payment method identifiers for the
payment methods that the website accepts and any associated payment method-specific
data.
[Value("methodData")]
public PaymentMethodData[] MethodData { get; }

Property Value

PaymentMethodData[]

An array of PaymentMethodData objects. Each object contains the following properties:

Remarks

Modifiers

NOTE
Experimental
The modifiers read-only property of the
PaymentRequestEvent interface returns an {{jsxref("Array")}} of PaymentDetailsModifier objects containing modifiers for payment details.
[Value("modifiers")]
public PaymentDetailsModifier[] Modifiers { get; }

Property Value

PaymentDetailsModifier[]

An array of objects containing modifiers for payment details. These objects contain the following properties:

Remarks

PaymentOptions

[Value("paymentOptions")]
public Object? PaymentOptions { get; }

Property Value

Object

PaymentRequestId

NOTE
Experimental
The paymentRequestId read-only property of the
PaymentRequestEvent interface returns the ID of the
PaymentRequest object.
[Value("paymentRequestId")]
public string PaymentRequestId { get; }

Property Value

string

A string containing the ID.

Remarks

PaymentRequestOrigin

NOTE
Experimental
The paymentRequestOrigin read-only property of the
PaymentRequestEvent interface returns the origin where the
PaymentRequest object was initialized.
[Value("paymentRequestOrigin")]
public string PaymentRequestOrigin { get; }

Property Value

string

A string.

Remarks

ShippingOptions

[Value("shippingOptions")]
public PaymentShippingOption[]? ShippingOptions { get; }

Property Value

PaymentShippingOption[]

TopOrigin

NOTE
Experimental
The topOrigin read-only property of the
PaymentRequestEvent interface returns the top-level payee origin where
the PaymentRequest object was initialized.
[Value("topOrigin")]
public string TopOrigin { get; }

Property Value

string

A string.

Remarks

Total

NOTE
Experimental
The total read-only property of the PaymentRequestEvent interface returns a
PaymentCurrencyAmount object containing the total amount being requested for payment.
[Value("total")]
public Object Total { get; }

Property Value

Object

A PaymentCurrencyAmount object. This object contains the following properties:

Remarks

Methods

ChangePaymentMethod(string, Object?)

NOTE
Experimental
The changePaymentMethod() method of the PaymentRequestEvent interface is used by the payment handler to get an updated total, given such payment method details as the billing address.
[Value("changePaymentMethod")]
public Task<PaymentRequestDetailsUpdate?> ChangePaymentMethod(string methodName, Object? methodDetails = null)

Parameters

methodName string
methodDetails Object

Returns

Task<PaymentRequestDetailsUpdate>

A Promise that resolves with a PaymentRequestDetailsUpdate object. This object contains the following properties:

Remarks

ChangeShippingAddress(AddressInit)

[Value("changeShippingAddress")]
public Task<PaymentRequestDetailsUpdate?> ChangeShippingAddress(AddressInit shippingAddress = null)

Parameters

shippingAddress AddressInit

Returns

Task<PaymentRequestDetailsUpdate>

ChangeShippingOption(string)

[Value("changeShippingOption")]
public Task<PaymentRequestDetailsUpdate?> ChangeShippingOption(string shippingOption)

Parameters

shippingOption string

Returns

Task<PaymentRequestDetailsUpdate>

OpenWindow(string)

NOTE
Experimental
The openWindow() method of the PaymentRequestEvent interface opens the specified URL in a new window, only if the given URL is on the same origin as the calling page. It returns a {{jsxref("Promise")}} that resolves with a reference to a WindowClient.
[Value("openWindow")]
public Task<WindowClient?> OpenWindow(string url)

Parameters

url string

Returns

Task<WindowClient>

A Promise that resolves with a reference to a
WindowClient.

Remarks

RespondWith(Task<PaymentHandlerResponse>)

NOTE
Experimental
The respondWith() method of the PaymentRequestEvent interface prevents the default event handling and allows you to provide a {{jsxref("Promise")}} for a payment handler response object yourself.
[Value("respondWith")]
public GlobalObject.Undefined RespondWith(Task<PaymentHandlerResponse> handlerResponsePromise)

Parameters

handlerResponsePromise Task<PaymentHandlerResponse>

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks