PaymentResponse
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The PaymentResponse interface of the Payment Request API is returned after a user selects a payment method and approves a payment request.
Instance properties
PaymentResponse.detailsRead only Secure context-
Returns a JSON-serializable object that provides a payment method specific message used by the merchant to process the transaction and determine successful fund transfer. The contents of the object depend on the payment method being used. Developers need to consult whomever controls the URL for the expected shape of the details object.
PaymentResponse.methodNameRead only Secure context-
Returns the payment method identifier for the payment method that the user selected, for example, Visa, Mastercard, Paypal, etc.
PaymentResponse.payerEmailRead only Secure context Deprecated Non-standard-
Returns the email address supplied by the user. This option is only present when the
requestPayerEmailoption is set totruein theoptionsparameter of thePaymentRequest()constructor. PaymentResponse.payerNameRead only Secure context Deprecated Non-standard-
Returns the name supplied by the user. This option is only present when the
requestPayerNameoption is set to true in theoptionsparameter of thePaymentRequest()constructor. PaymentResponse.payerPhoneRead only Secure context Deprecated Non-standard-
Returns the phone number supplied by the user. This option is only present when the
requestPayerPhoneoption is set totruein theoptionsparameter of thePaymentRequest()constructor. PaymentResponse.requestIdRead only Secure context-
Returns the identifier of the
PaymentRequestthat produced the current response. This is the same value supplied in thePaymentRequest()constructor bydetails.id. PaymentResponse.shippingAddressRead only Secure context Deprecated Non-standard-
Returns the shipping Address supplied by the user. This option is only present when the
requestShippingoption is set totruein theoptionsparameter of thePaymentRequest()constructor. PaymentResponse.shippingOptionRead only Secure context Deprecated Non-standard-
Returns the ID attribute of the shipping option selected by the user. This option is only present when the
requestShippingoption is set totruein theoptionsparameter of thePaymentRequest()constructor.
Instance methods
PaymentResponse.retry()Secure context-
If something is wrong with the payment response's data (and there is a recoverable error), this method allows a merchant to request that the user retry the payment. The method takes an object as argument, which is used to signal to the user exactly what is wrong with the payment response so they can try to correct any issues.
PaymentResponse.complete()Secure context-
Notifies the user agent that the user interaction is over. This causes any remaining user interface to be closed. This method should only be called after the Promise returned by the
PaymentRequest.show()method. PaymentResponse.toJSON()Secure context-
Returns a JSON object representing this
PaymentResponseobject.
Events
Listen to this event using addEventListener() or by assigning an event listener to the oneventname property of this interface.
payerdetailchangeSecure context Deprecated Non-standard-
Fired during a retry when the user makes changes to their personal information while filling out a payment request form. Allows the developer to revalidate any requested user data (e.g., the phone number or the email address) if it changes.
Specifications
| Specification |
|---|
| Payment Request API 1.1 # paymentresponse-interface |
Browser compatibility
BCD tables only load in the browser