MerchantValidationEvent
interface
Copyright © 2020 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply.
Merchant validation is the process by which a payment handler validates the identity of a merchant against some value (usually some cryptographic challenge response). Validated merchants are allowed to interface with a payment handler. Details of how actual validation is performed is outside the scope of this specification.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.
This feature was removed from Payment Request API due to lack of interoperable support. However, as it is implemented by at least one browser engine, the Working Group decided to publish this document as a Working Group Note.
This document was published by the Web Payments Working Group as a First Public Working Group Note.
GitHub Issues are preferred for discussion of this specification.
Publication as a Working Group Note does not imply endorsement by the W3C Membership.
This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the 1 August 2017 W3C Patent Policy. The group does not expect this document to become a W3C Recommendation.
This document is governed by the 15 September 2020 W3C Process Document.
PaymentRequest
interface
WebIDLpartial interface PaymentRequest {
attribute EventHandler onmerchantvalidation
;
};
onmerchantvalidation
attribute
A PaymentRequest
's
attribute is an onmerchantvalidation
EventHandler
for a
named "MerchantValidationEvent
merchantvalidation
".
MerchantValidationEvent
interface
WebIDL[SecureContext, Exposed=Window] interfaceMerchantValidationEvent
: Event {constructor
(DOMString type, optionalMerchantValidationEventInit
eventInitDict = {}); readonly attribute DOMStringmethodName
; readonly attribute USVStringvalidationURL
; undefinedcomplete
(Promise<any> merchantSessionPromise); };
Instances of
are created with the
internal slots in the following table:
MerchantValidationEvent
Internal Slot | Description (non-normative) |
---|---|
[[waitForUpdate]] |
A boolean indicating whether a
complete () -initiated update is currently in
progress.
|
MerchantValidationEvent
constructor
The event constructing steps, which take a
event, are as
follows:
MerchantValidationEvent
validationURL
and base.
TypeError
.
validationURL
attribute to validationURL.
methodName
is
not the empty string, run the steps to validate a payment method
identifier with
eventInitDict.methodName
. If it
returns false, then throw a RangeError
exception. Optionally,
inform the developer that the payment method identifier is invalid.
methodName
attribute to
eventInitDict.methodName
.
[[waitForUpdate]]
to false.
methodName
attribute
When getting, returns the value it was initialized with. See
member of
methodName
for more information.
MerchantValidationEventInit
validationURL
attribute
A URL from which a developer can fetch payment
handler-specific verification data. By then passing that data (or a
promise that resolves with that data) to
complete
()
, the user agent can verify that the
payment request is from an authorized merchant.
When getting, returns the value it was initialized with.
complete()
method
The
's
MerchantValidationEvent
complete(merchantSessionPromise)
method MUST act as
follows:
isTrusted
attribute is false, then
throw an "InvalidStateError
" DOMException
.
[[waitForUpdate]]
is true,
then throw an "InvalidStateError
" DOMException
.
[[state]
is not "interactive"
, then
throw an "InvalidStateError
" DOMException
.
[[updating]]
is true, then throw an
"InvalidStateError
" DOMException
.
[[waitForUpdate]]
to
true.
MerchantValidationEventInit
dictionary
WebIDLdictionaryMerchantValidationEventInit
: EventInit { DOMStringmethodName
= ""; USVStringvalidationURL
= ""; };
methodName
member
validationURL
member
For payment handlers that support merchant validation, the user
agent runs the request merchant validation algorithm. The
algorithm takes a USVString
merchantSpecificURL, provided by the
payment handler:
PaymentRequest
object that
the user is interacting with.
[[updating]]
is false.
[[state]
is "interactive"
.
MerchantValidationEventInit
dictionary.
validationURL
] to
validationURL.
methodName
to methodName.
MerchantValidationEvent
with
"merchantvalidation
" and eventInitDict.
isTrusted
attribute to true.
The validate merchant's details algorithm takes a
Promise
opaqueDataPromise and a PaymentRequest
request. The
steps are conditional on the opaqueDataPromise settling. If
opaqueDataPromise never settles then the payment request is blocked.
The user agent SHOULD provide the user with a means to abort a payment
request. Implementations MAY choose to implement a timeout for pending
updates if opaqueDataPromise doesn't settle in a reasonable amount of
time. If an implementation chooses to implement a timeout, they MUST
execute the steps listed below in the "upon rejection" path. Such a
timeout is a fatal error for the payment request.
[[updating]]
to true.
AbortError
"
DOMException
.
[[updating]]
to false.
It is important that the
in a
validationURL
does not expose personally identifying
information to unauthorized parties.
MerchantValidationEvent
This section is non-normative.
Event name | Interface | Dispatched when… | Target |
---|---|---|---|
merchantvalidation
|
|
The user agent requires the merchant to perform merchant validation. |
PaymentRequest
|
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, and SHOULD in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.