We have a site example.com behind ssl that runs a page with ApplePay. We've got a server side that returns a Merchant Session that looks like the following:
{"epochTimestamp":1581975586106,"expiresAt":1581979186106,"merchantSessionIdentifier":"SSH8E666B0...","nonce":"1239e567","merchantIdentifier":"...8557220BAF491419A...","domainName":"example.com","displayName":"ApplePay","signature":"...20101310f300d06096086480165030402010500308..."}
We receive this response in session.onvalidatemerchant
as a string and convert it to a Json Object and pass to session.completeMerchantValidation
.
As a result we get the following error:
Code: "InvalidAccessError"
Message: "The object does not support the operation or argument"
We run the following code on our page:
.....
session.onvalidatemerchant = (event) => {
const validationURL = event.validationURL;
getApplePaySession(validationURL).then(function (response) {
try {
let resp = JSON.parse(response);
session.completeMerchantValidation(resp);
} catch (e) {
console.error(JSON.stringify(e));
}
});
};
....
Additional questions:
- Is the object described above a "correct" Merchant Session opaque that needs to be passed to
completeMerchantValidation
or it's missing some fields? - Is this object needs to be passed as is or it needs to be base64 encoded?
- Does it need to be wrapped into another object?
Any help or lead is greatly appreciated.