PaymentResponse Class

The response of the user who accepted a payment request (https://w3c.github.io/payment-request/#paymentresponse-interface): the page processes the payment, then calls PaymentResponse.Complete, or PaymentResponse.Retry to let the user fix errors.

public sealed class PaymentResponse : EventTarget
Inheritance
EventTarget PaymentResponse

Properties

NameDescription
DetailsGets the response of the payment handler (a JavaScript object whose shape is defined by the payment method).
MethodNameGets the identifier of the payment method that the user selected.
OnPayerDetailChangeGets or sets the event handler of the payerdetailchange event.
PayerEmailGets the email address of the payer, or null when the request does not request it.
PayerNameGets the name of the payer, or null when the request does not request it.
PayerPhoneGets the phone number of the payer, or null when the request does not request it.
RequestIdGets the identifier of the payment request.
ShippingAddressGets the full shipping address chosen by the user, or null when the request does not request shipping.
ShippingOptionGets the identifier of the selected shipping option, or null when the request does not request shipping.

Gets the response of the payment handler (a JavaScript object whose shape is defined by the payment method).

public object Details { get; }

Gets the identifier of the payment method that the user selected.

public string MethodName { get; }

OnPayerDetailChange

PaymentResponse.cs

Gets or sets the event handler of the payerdetailchange event.

public Action<Event>? OnPayerDetailChange { get; set; }

Gets the email address of the payer, or null when the request does not request it.

public string? PayerEmail { get; }

Gets the name of the payer, or null when the request does not request it.

public string? PayerName { get; }

Gets the phone number of the payer, or null when the request does not request it.

public string? PayerPhone { get; }

Gets the identifier of the payment request.

public string RequestId { get; }

ShippingAddress

PaymentResponse.cs

Gets the full shipping address chosen by the user, or null when the request does not request shipping.

public ContactAddress? ShippingAddress { get; }

ShippingOption

PaymentResponse.cs

Gets the identifier of the selected shipping option, or null when the request does not request shipping.

public string? ShippingOption { get; }

Methods

NameDescription
Complete(PaymentComplete, PaymentCompleteDetails?)Tells the user agent that the payment is processed (https://w3c.github.io/payment-request/#complete-method): the payment sheet is closed (UserAgentUIBackend.CompletePaymentAsync). The task fails with an InvalidStateError DomException when the response is already complete or is being retried, and with an AbortError when the document is unloaded first.
Retry(PaymentValidationErrors?)Asks the user to fix the errors of the response (https://w3c.github.io/payment-request/#retry-method): the payment sheet is shown again (UserAgentUIBackend.RetryPaymentAsync), and the task completes once the user accepts the payment again: the members of the response are updated. The task fails with an InvalidStateError DomException when the document is not fully active, the response is complete or is already being retried, with a NotSupportedError when the payment was not accepted in the payment sheet (Secure Payment Confirmation), and with an AbortError when the user dismisses the sheet.

Complete(PaymentComplete, PaymentCompleteDetails?)

PaymentResponse.cs

Tells the user agent that the payment is processed (https://w3c.github.io/payment-request/#complete-method): the payment sheet is closed (UserAgentUIBackend.CompletePaymentAsync). The task fails with an InvalidStateError DomException when the response is already complete or is being retried, and with an AbortError when the document is unloaded first.

public Task Complete(PaymentComplete result = PaymentComplete.Unknown, PaymentCompleteDetails? details = null)

Retry(PaymentValidationErrors?)

PaymentResponse.cs

Asks the user to fix the errors of the response (https://w3c.github.io/payment-request/#retry-method): the payment sheet is shown again (UserAgentUIBackend.RetryPaymentAsync), and the task completes once the user accepts the payment again: the members of the response are updated. The task fails with an InvalidStateError DomException when the document is not fully active, the response is complete or is already being retried, with a NotSupportedError when the payment was not accepted in the payment sheet (Secure Payment Confirmation), and with an AbortError when the user dismisses the sheet.

public Task Retry(PaymentValidationErrors? errorFields = null)