大网数据广告活动
Web 标准与前端开发

PaymentResponse

· 52CE 我爱测

The **`PaymentResponse`** interface of the Payment Request API is returned after a user selects a payment method and approves a payment request.

Payment Request API

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.details
    • : 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.methodName
    • : Returns the payment method identifier for the payment method that the user selected, for example, Visa, Mastercard, PayPal, etc.
  • PaymentResponse.payerEmail
    • : Returns the email address supplied by the user. This option is only present when the requestPayerEmail option is set to true in the options parameter of the PaymentRequest.PaymentRequest constructor.
  • PaymentResponse.payerName
    • : Returns the name supplied by the user. This option is only present when the requestPayerName option is set to true in the options parameter of the PaymentRequest.PaymentRequest constructor.
  • PaymentResponse.payerPhone
    • : Returns the phone number supplied by the user. This option is only present when the requestPayerPhone option is set to true in the options parameter of the PaymentRequest.PaymentRequest constructor.
  • PaymentResponse.requestId
    • : Returns the identifier of the PaymentRequest that produced the current response. This is the same value supplied in the PaymentRequest.PaymentRequest constructor by details.id.
  • PaymentResponse.shippingAddress
    • : Returns the shipping Address supplied by the user. This option is only present when the requestShipping option is set to true in the options parameter of the PaymentRequest.PaymentRequest constructor.
  • PaymentResponse.shippingOption
    • : Returns the ID attribute of the shipping option selected by the user. This option is only present when the requestShipping option is set to true in the options parameter of the PaymentRequest.PaymentRequest constructor.

Instance methods

  • PaymentResponse.retry()
    • : 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()
    • : 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()
    • : Returns a JSON-serializable plain object representing the PaymentResponse object. Automatically called by JSON.stringify().

Events

Listen to this event using addEventListener() or by assigning an event listener to the oneventname property of this interface.

  • payerdetailchange
    • : 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

Browser compatibility

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。