1

We are trying to add Apple Pay to our existing web site. I have the payment sheet popping up, and am seeing the call to onvalidatemerchant which in turn calls our server that returns what looks to be a valid Merchant Session object, but when I call completeMerchantValidation with the object I get a Type Error with no other information.

Has anyone come across this and found a way to resolve the error. I am testing on an iPad Mini with iOS 10.2.1.

Coding Smackdown
  • 1,173
  • 8
  • 14
  • Are you passing the opaque merchant session back to the `completeMerchantValidation` as-is with no additional decoration (e.g. extra properties) as an object parsed from the JSON in the response? Have you authorized the domain name you're testing with in the Apple Pay Developer portal for the merchant certificate you're using? – Martin Costello Mar 27 '17 at 15:00

1 Answers1

4

Solution posted here in-case someone else has a similar problem.

It turns out that you need to pass a JavaScript object to completeMerchantValidation. It turned out I was passing a JSON string to completeMerchantValidation and needed to convert it to an object by using JSON.parse(response.data.Result); then things started working as expected.

Coding Smackdown
  • 1,173
  • 8
  • 14
  • Using the fetch api, I had this exact issue using `response.json()` -- contrary to my expectations, it was returning a string, not a json object. – starwed Feb 08 '19 at 15:48