---
title: onvalidatemerchant
framework: applepayontheweb
role: symbol
role_heading: Instance Property
path: applepayontheweb/applepaysession/onvalidatemerchant
---

# onvalidatemerchant

An event handler the system calls when it displays the payment sheet.

## Declaration

```data
attribute EventHandler onvalidatemerchant;
```

## Mentioned in

Providing Merchant Validation Requesting an Apple Pay payment session

## Discussion

Discussion Use this attribute to request and return a merchant session. You must set this attribute to the following function: session.onvalidatemerchant = function(event) {} where event is an ApplePayValidateMerchantEvent object. The process to complete the merchant validation is as follows: Your onvalidatemerchant function calls your server, and passes it the static hostname apple-pay-gateway.apple.com as the validation URL. In the China region, use cn-apple-pay-gateway.apple.com. Your server uses the validation URL to request a session from the Apple Pay server, as described in Requesting an Apple Pay payment session. In response, your server receives an opaque merchant session object, MerchantSession. You pass the merchant session object to the completion method, completeMerchantValidation. The system enables the payment sheet. note: Previous merchant validation instructions stated that your onvalidatemerchant function must call your server and pass it the URL from the event’s validationURL attribute. Apple Pay continues to support this flow for existing implementations.

## See Also

### Related Documentation

- [Providing Merchant Validation](applepayontheweb/providing-merchant-validation.md)

### Getting merchant validation

- [begin](applepayontheweb/applepaysession/begin.md)
- [completeMerchantValidation](applepayontheweb/applepaysession/completemerchantvalidation.md)
- [ApplePayValidateMerchantEvent](applepayontheweb/applepayvalidatemerchantevent.md)
