17

I am setting up Apple Pay on the web with Stripe and want to use the Sanbox Tester account we setup in iTunes Connect to test on both iOS and macOS in Safari.

On the test device (2017 iPad) I have logged in to iCloud with the Sandbox Tester account and added a test card into Wallet in the settings app. On my development website the Apple Pay button is showing up and interactions work fine.

I created a new account on my MacBook Pro (Retina, Mid 2015) and again logged in to iCloud with the same Sandbox Tester account. When I view my development website on here, however, the checkAvailability function always returns false:

Stripe.applePay.checkAvailability(function(available) {
  alert(available);
  ...
}

Presumably this is because I need further setup for Apple Pay to work. But for the life of me I can't get macOS cooperate. After reading some documentation here are some points that I think are relevant:

  • In my iPad's Wallet & Apple Pay settings there isn't an "Allow payments on Mac" option anywhere
  • There is no Wallet & Payments option in my macOS Settings app
  • There is no mention of Apple Pay in macOS Safari settings, privacy tab
  • Handoff is enabled on the Mac

Is it possible for me to enable test payments with my sandbox user on macOS using handoff, and if so what steps am I missing?

Update

  • My macOS Sierra version is 10.12.4 (16E195)
  • Running window.ApplePaySession.canMakePayments() in the console returns false

Update 2

The steps outlined here are all in place on both devices. When I open Safari on the MacBook and navigate to a page, the handoff icon shows on the multi-tasking screen and vice-vera, when I open a tab in iOS Safari, the handoff icon shows to the left of the dock. It appears handoff is working as expected.

Also, Universal Clipboard is working in both directions.

Note: On a different (non-sandbox) iCloud account on this same MacBook, which is using handoff with a different iPad, the payment options show up in Safari as expected.

LeonardChallis
  • 7,759
  • 6
  • 45
  • 76

2 Answers2

10

Apparently, Apple Pay on the Web using handoff is not possible with iPads. The only compatible devices are:

A Mac model introduced in 2012 or later with an Apple Pay-enabled iPhone or Apple Watch

This comes directly from Apple. Pretty explicit details can be found on this page.

LeonardChallis
  • 7,759
  • 6
  • 45
  • 76
6

Edit from Leonardo: only iPhones and iWatches are supported to use ApplePay with handoff.


Looking at the source of the Stripe checkAvailability method might also help troubleshoot the problem.

Stripe.applePay.checkAvailability = function (callback) {
  if (location.protocol !== 'https:') {
    return callback(false);
  }

  var canMakePayments = window.ApplePaySession && ApplePaySession.canMakePayments()

  if (/^pk_test_/.test(Stripe.key || Stripe.publishableKey)) {
    callback(canMakePayments)
  } else if (canMakePayments) {
    var merchantId = "merchant." + window.location.hostname + ".stripe"
    ApplePaySession.canMakePaymentsWithActiveCard(merchantId).then(callback)
  } else {
    callback(false)
  }
}

Given you said that it was working with your iPad, I'm assuming your domain is already using ssl and the right cypher suite.

Since you are testing, the canMakePaymentsWithActiveCard shouldn't even been called since your stripe key should be a testing one, and if your look at the canMakePayments documentation , you can see they clearly stipulate that:

It does not verify whether or not the user has any provisioned cards in Wallet.

To make sure that your device is really supporting it, you should execute directly from your console

window.ApplePaySession.canMakePayments()

And make sure this returns true, if it does that means the issue belongs to the Stripe configuration rather than Apple Pay.

The other thing I see that could cause the problem would be the OS version of your mac. Your iPad is pretty new and thus will have the latest version already, but having bought your MacBook in 2015 does not necessary means you made the upgrade to Sierra (macOS 10.12) which is required to use ApplePay.

I'm sure you probably already tried all these things, I'm just making sure we didn't forgot anything.

Since HandOff seems to be required, make sure you also have all these requirements checked.

Preview
  • 35,317
  • 10
  • 92
  • 112
  • 1
    Thanks. I've added more details to my question. I'm up to date with Sierra and canMakePayments() is returning false. I presume this will continue until I actually somehow activate the wallet options via handoff? – LeonardChallis May 01 '17 at 07:41
  • 1
    Ah, then yes, you will need handoff. Make sure you have all the checklist of requirements stipulated [here](https://support.apple.com/en-us/HT204681). – Preview May 01 '17 at 17:55
  • 1
    Handoff *is* enabled, as mentioned in the question. I've added more detail on my question. – LeonardChallis May 02 '17 at 07:40