iOS 10 Beta 3 + Apple Pay Web

Hi,

if anyone can shed some light on this. I've managed to progress to the point where merchant validation is successful and the displayed Apple Pay sheet has the fingerprint reader available. In the previous beta when I validated the request it would simply display "Payment Not Successful", the sheet would remain and no call backs or any other debugging information would be provided. In this release I get the same message on the Apple Pay sheet but a modal dialog pops up saying:


"Apple Pay is Not Available For This Website"


Again no call backs are made or any other debugging information made available. All the certs in use check out and I've peformed the website validation required in the developer portal. I understand the reasoning behind not leaking too much information but it would be good if we had some call back:


applePaySession.onpaymentauthorized = function(event) {
    var paymentRequest = {
        // Build payment request from event payment tokens.
    };
    performPayment(paymentRequest).then(function(paymentResult) {
       // For now choose STATUS_SUCCESS, should examine the response from backend in paymentResult.
        applePaySession.completePayment(ApplePaySession.STATUS_SUCCESS);
    }).catch(function(error) {
        console.log(error);
    });
};


Which is never called, but an event handler like `onpaymentfailed`. I guess the intention here is that if the payment fails to authorise at Apple's end no amount of back end shenanigans will change that and it's up to the user to dismiss the Apple Pay dialog and if necessary choose an alternate payment method.


Has anyone else got this far or further? What were your experiences?


Paul

Answered by NorfolkMustard in 169066022

Hi. Yeah. At this stage (apple haven't gone live with applepayjs yet) you'll only get a successful transaction flow if you use an iCloud sandpit account created in your apple developer settings, and in that sandpit account you attach dummy credit cards also provided by apple https://developer.apple.com/support/apple-pay-sandbox/ Loads of details also on my GitHub github.com/norfolkmustard/ApplePayJS

Hi Paul,


Looks like you are so fast!!! I haven't reached this yet. I am so sorry that I couldn't help you here... Could you please let me know the steps that you did to do the merchant validation? possibly starting from firewall request..


Thanks

Hi


Are you using an iCloud account from the sandbox? I get the same "Apple Pay is Not Available For This Website" error but only when trying it with a live iCloud account and credit card. Try it with a sandbox account.


seems apple have turned something off their end in the last few days too - I was getting to/past the fingerprint stage but now it hangs on "Processing" on the payment sheet (tried live and sandbox icloud accounts on iOS10b3). "Processing" is the stage when apple verify the merchant session object in


session.completeMerchantValidation(merchantSession);

Hi NorfolkMustard,


I am able to see the payment sheet when i installed Beta 3 version. However, looks like merchant validation is not happening properly, so the touch id is not showing up. Could you please let me know whether you opened any firewall with Apple? Are you done with merchant validation and seeing the touch id in you local server instance or in a staging environment which is opened to net?


Thanks

JPCP

I'm happy to cut/paste code examples if you let me know where you are stuck? I thought I'd get email notifications for replies but it seems I didn't so apologies if this is too late.

Are you using an iCloud account from the sandbox?


What do you mean by "from the sandbox"? Does this mean I can get further if I manually manipulate the url I use for merchant validation?


** Update **


Checked and the url I was getting was https://apple-pay-gateway-cert.apple.com/paymentservices/startSession. Symptoms are the same as when I posted. Merchant validation completes OK but then I get a red exclamation and "Payment Not Completed". Snippets of the code in question below.


function performValidation(valURL) {
  return new Promise(function(resolve, reject) {
    var xhr = new XMLHttpRequest();
    xhr.onload = function() {
        var data = JSON.parse(this.responseText);
        resolve(data);
    };
    xhr.onerror = reject;
    xhr.open('POST', '/mobile/merchant/');
    xhr.send(JSON.stringify({'u' : valURL}));
  });
}

applePaySession.onvalidatemerchant = function (event) {
  console.log("Validate url : " + event.validationURL);
  performValidation(event.validationURL).then(function(merchantSession) {
    applePaySession.completeMerchantValidation(merchantSession);
  }).catch(function(error) {
    console.log(error);
  })
};


applePaySession.onpaymentauthorized = function(event) {
 // Never reached.
}
Accepted Answer

Hi. Yeah. At this stage (apple haven't gone live with applepayjs yet) you'll only get a successful transaction flow if you use an iCloud sandpit account created in your apple developer settings, and in that sandpit account you attach dummy credit cards also provided by apple https://developer.apple.com/support/apple-pay-sandbox/ Loads of details also on my GitHub github.com/norfolkmustard/ApplePayJS

That was my missing link. I had no dummy cards just my real one; in that sense it behaves a little differently to t'other Apple Pay as I could simply use my test PSP credentials to ensure no monies actually moved.


That's made my day that has. Thank you! 😀

iOS 10 Beta 3 + Apple Pay Web
 
 
Q