applepayapplepayjs

OnCancel getting called immediately after onvalidatemerchant


I'm trying to set up a POC for applepay processing on the web. I have a site on Azure that is a verified merchant domain, and am able to generate payment sessions that look valid as far as I can tell, e.g.

{
    "epochTimestamp": 1618320255698,
    "expiresAt": 1618323855698,
    "merchantSessionIdentifier": "some identifier",
    "nonce": "some nonce",
    "merchantIdentifier": "some identifier",
    "domainName": "myVerifiedDomain.azurewebsites.net",
    "signature": "a nice long signature",
    "operationalAnalyticsIdentifier": "display name:the merchant session identifier above",
    "retries": 0
}

This is generated in the onvalidatemerchant event handler, and passed into session.completeMerchantValidation.

Using a sandbox account or a live Apple account with linked cards, the next thing that happens is an immediate "payment not completed" message in the ApplePay popup on the page, and the oncancel event is hit Inspecting the event, I don't see anything that hints at the issue. There is a sessionError object, but its code is "unknown" and the info object is empty.

What could be causing this? Other reports I've found seem to be mostly about the domain being unverified, but it definitely matches what is verified, and I've tried a few variations (including the https://, and the full page URL rather than just the domain) and I get the same symptoms


Solution

  • I've figured it out. The displayName property was missing in my model so wasn't being deserialised from the JSON