我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
您也可以阅读此文章的English (US)版。
Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The PaymentResponse
interface of the Payment Request API is returned after a user selects a payment method and approves a payment request.
Properties
PaymentResponse.details
Read 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. This data is returned by the payment app that satisfies the payment request, and must conform to the structure defined in the
BasicCardResponse
dictionary. PaymentResponse.methodName
Read only Secure context- Returns the payment method identifier for the payment method that the user selected, for example, Visa, Mastercard, Paypal, etc..
PaymentResponse.payerEmail
Read only Secure context- Returns the email address supplied by the user. This option is only present when the
requestPayerEmail
option is set totrue
in theoptions
parameter of thePaymentRequest()
constructor. PaymentResponse.payerName
Read only Secure context- Returns the name supplied by the user. This option is only present when the
requestPayerName
option is set to true in theoptions
parameter of thePaymentRequest()
constructor. PaymentResponse.payerPhone
Read only Secure context- Returns the phone number supplied by the user. This option is only present when the
requestPayerPhone
option is set totrue
in theoptions
parameter of thePaymentRequest()
constructor. PaymentResponse.shippingAddress
Read only Secure context- Returns the shipping Address supplied by the user. This option is only present when the
requestShipping
option is set totrue
in theoptions
parameter of thePaymentRequest()
constructor. PaymentResponse.shippingOption
Read only Secure context- Returns the ID attribute of the shipping option selected by the user. This option is only present when the
requestShipping
option is set totrue
in theoptions
parameter of thePaymentRequest()
constructor.
Methods
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.
Specifications
Specification | Status | Comment |
---|---|---|
Payment Request API The definition of 'PaymentResponse' in that specification. |
Working Draft | Initial definition. |
Browser Compatibility
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | No support | (Yes) | No support[1] | ? | ? | ? |
payerName property |
60 | ? | No support[1] | ? | ? | ? |
Feature | Android Webview | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | No support | 53 | (Yes) | No support[1] | ? | ? | ? |
payerName property |
No support | 58 | ? | No support[1] | ? | ? | ? |
[1] Supported since 56 but disabled on all versions. Hidden behind the dom.payments.request.enabled
pref.