Validate your merchant identity and receive a session object for each payment request.
Framework
- Apple Pay JS
Overview
As soon as the payment sheet is displayed, the Apple Pay JS API calls your session object’s onvalidatemerchant
event handler to verify that the request is coming from a valid merchant. It passes the function an Apple
object that contains the validation URL.
In your onvalidatemerchant
function:
You call your server, passing it the URL from the event’s
validation
property.URL Your server uses the validation URL to request a session from the Apple Pay server, as described in Requesting an Apple Pay Payment Session.
Note
This request must be sent from your server; never request the merchant session from the client.
The URL you receive can vary, so always use the URL provided in the
validation
property. Your server must allow access to all the validation URLs, which are listed in Setting Up Your Server.URL In response, your server receives an opaque merchant session object, MerchantSession.
You pass the merchant session object to your Apple Pay session’s
complete
method.Merchant Validation Note
You can use the merchant session object a single time. It expires five minutes after it is created.