PaymentRequest.onmerchantvalidation

Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The PaymentRequest event handler onmerchantvalidation is invoked when the merchantvalidation is fired, indicating that the payment handler (e.g., Apple Pay) requires the merchant to validate themselves. This is usually the first event to be fired, and the user won't be able to proceed with a payment until the merchant validate themselves.

This event is not be fired by all payment handlers. In particular, it's used by Apple Pay.

Syntax

paymentRequest.onmerchantvalidation = eventHandlerFunction;

Value

An event handler function which is to be called whenever the merchantvalidation event is fired at the PaymentRequest, indicating that the payment handler requires the merchant to validate themselves as allowed to use this payment handler.

Examples

An example merchant validation is shown below:

request.onmerchantvalidation = ev => {
    ev.complete(async () => {
        // get validation data, and complete validation;
        return await fetch(ev.validationURL).then(r => r.text());
    })
};
const response = await request.show();

Specifications

Specification Status Comment
Payment Request API
The definition of 'onmerchantvalidation' in that specification.
Candidate Recommendation Initial definition.

Browser compatibility

No compatibility data found. Please contribute data for "api.PaymentRequest.onmerchantvalidation" (depth: 1) to the MDN compatibility data repository.

Document Tags and Contributors

Contributors to this page: Sheppy, marcoscaceres
Last updated by: Sheppy,