Hi we are trying to integrate Apple Pay on a website using the payment provider Pay360.
Pay360 have provided us with the domain-verification file and we have uploaded it to the merchant domain -
/.well-known/apple-developer-merchantid-domain-association
When we try to checkout we get this message in the dev console -
"Unsupported Apple Pay validation domain"
This is the Pay360 integration docs: https://docs.pay360.com/alternative-payments/getting-started-with-apple-pay/
I've included the code used at the checkout that creates the Apple Pay session but it's not triggering the 'session.onvalidatemerchant' function because of that I can't get 'validationURL' from that event.
Please can someone advise how to fix?
Here's the code -
jQuery(document).on('click','#applePay',function() {
var paymentRequest = {
countryCode: 'GB',
currencyCode: 'GBP',
supportedNetworks: ['visa', 'masterCard', 'amex', 'discover'],
merchantCapabilities: [ 'supports3DS' ],
total: { label: 'Online Store', amount: '0.05' },
};
var session = new ApplePaySession(3, paymentRequest);
session.onvalidatemerchant = function (event) {
console.log(event);
var url = event.validationURL;
alert(url);
}
session.onpaymentauthorized = function (event) {
console.log(event);
}
session.oncancel = function(event) {
console.log(event);
}
session.begin();
});
We asked Pay360 Support for help but they asked us to contact Apple for help.
Here is what Pay360 said -
Unfortunately at this point Pay360 cannot support you anymore as it is not a problem at our end.
The issue is between the yourself and ApplePay especially as you are going down the API path. Therefore, if you are still encountering further issues after the previous advice has been taken, you should in the first instance review ApplePay's integration documentation or contact ApplePay.
Previous advice -
From the code snippet given, the merchant is calling begin() before they've finished initialising the ApplePaySession object - it makes sense that it wouldn't trigger the onvalidatemerchant event if there wasn't one set at that point.
The merchant should bind onvalidatemerchant and onpaymentauthorized (and anything else they want to bind on the session) before calling the begin() function.
This should enable the merchant to continue debugging the problem.