How do you test Apple Pay in Safari? - safari

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.

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.

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.

Related

Xcode Simulator: How do I get the settings "Screen time"?

I try to test in app purchases with sandbox users. Unfortunately I always get the error "Cannot connect to itunes store". All bug fixes I've seen mention you should reset some settings in the "Screen time" section of the settings app. However, I don't have any screen time in the settings app. What am I missing? iOS version is 13.3 of the test device. I've also tried to login to the itunes account with the sandbox user, but this doesn't work of course. So what am I missing?
In app purchase testing on the simulator is impossible. Test only on a device. When you run the app from Xcode, the sandbox user will be used automatically; no need to sign out of your normal user. Even simpler, use TestFlight.

Mac App crashes when I add a Distribution Profile

I've created a Mac App for Mavericks that uses MapKit. It works fine during development and testing on Xcode 5.1. Now I'd like to submit it to the App Store and I need a Distribution Profile which I've created successfully. Trouble is, as soon as I add it to my project, the app doesn't run anymore - it crashes every time without fail with this error message:
When I change back to "no provisioning profile", or to the profile that Xcode created during development, the app runs again.
My question: Is this expected behaviour, or will the app be rejected by the review team? I know that iOS apps don't run with their distribution profiles, but I'm new to Mac Development. Any insights into this way too complex topic are appreciated!
My app was approved - and the crash was indeed no issue for the app review team.
I had a chat with Apple about this who were kind enough to call me back and explain the issue. Looks like this phenomenon is "kind of" expected behaviour: Mac Apps may or may not crash when run with a Distribution Profile.
To avoid this problem, we can add both a Development AND a Distribution Profile to our app, without one having to replace the other. This was news to me. Had I however opened my tired eyes a bit wider I would have perhaps spotted the little disclosure triangle myself:
Perhaps this helps those with the same issue.

App Wireless Distribution not working in iOS7. Internet Connection needed?

In iOS6 I used to install some of my apps over an adhoc network without internet sharing. So the iPad had no internet connection. Therefore I use a typical html and plist file. Everything was alright.
Now, in iOS7 the installation is not working anymore. It is just stuck in "Waiting" and nothing more happens. (Note: It is still working on my iOS6 iPad)
First I thought something might be wrong with my plist, but then I copied the files to my IIS Server and installed it from there. Here I had a internet connection on my iPad and everything worked out.
Is it possible that the wireless distribution now needs an internet connection in iOS7 e.g. to check the ipa in the app store or something like that? Because this is the only difference I can see.
The app is signed with a valid distribution profile.
Thanks for your help.
It turned out the installation of apps over the air in iOS 7 really needs an internet connection now. The iPad tries to contact at least the following URLs before installing the app.
ax.init.itunes.apple.com: The device obtains the current file-size limit for downloading apps over the cellular network.
ocsp.apple.com: The device contacts this site to check the status of the distribution certificate used to sign the provisioning profile.
It seems in iOS6 it was ok if those URLs were not reachable and now in iOS 7 they have to be reachable.
Well i just had the same problem and I figured it out. At least on my xcode this is what happened. Turns out the application target release code siging identities auto set to developer and not their current state, from xcode 4.x, which is distribution. So when I went to distribute my application I kept getting the same error you had. So Click on your project name in your project explorer then click on the application target, not the project, and make sure the code signing identity is not set to developer for your releases. I have no idea why the code signing identities were automatically set to the developer profile, maybe there was some sort of bug when updating from xcdoe 4.x to xcode 5 that caused this. But now other devices are able to install the program. Hope this helps.

How to programmatically lock an iPad app into one single application?

we are doing a product display iPad app and don't want customers to be able to quit the app pressing the home button. We're planning to use only UIGesture to let the admin users to quit. How to programmatically lock an iPad app into one single application without install any third party app or profile?
There is a feature for this added in iOS 6 Beta 2 called Guided Access, see http://www.idownloadblog.com/2012/06/26/ios-6-guided-access/
Install the iPhone Configuration Utility: http://support.apple.com/kb/DL1465?viewlocale=en_US&locale=en_US
Make a .mobileconfig with the SBStoreDemoAppLock property set to true
Install the mobile config on the device.
Installation of the mobile config can be done using either the iPCU app or by opening the file with Safari on the device.
Now the device is in kiosk mode and the home button is disabled.
Remove the .mobileconfig file (again using the iPCU app) and reboot the device to re-enable the home button.
I believe that the common solution to this problem is a case that covers the home and power buttons. In practice, you'll want something that is fairly robust to prevent theft of the iPad, and that neatly covers access to the dock connector whilst providing power.
A quick google search of iPad kiosk case turns up plenty of options. Use of iPads as PoS displays in stores and at trade shows is incredibly popular.

Is there a testing phase for iTunes and Android Market?

I have a small app I've made that I intend to make available on both iTunes and on Android Market (AM).
I have purchased the developer certifications for both, built my app with the Android SDK and the iOS Xcode SDK. So I think I'm most of the way along.
I'm a little fuzzy on the steps after this, though. When I launch my app, I'd like it to be available on each market on more or less the same time. I'd also like to do a little testing to try and download each app to different people's devices for a beta phase. Also, my understanding is that iTunes requires some sort of approval before it goes live (does Android require the same?).
So, what I'd like to do is be able to put my app on both AM and iTunes, but have it not be publicly available. A sort of private phase, where I can test it, have selected testers download it, make sure it is working fine, and maybe even get Apple (and Android) approval.
Then, when I'm ready to go live, then mark my apps as public.
Is there anything like that on either market? If I upload my app to either market, is it from that moment publicly available?
If there isn't any such "private" phase, what is the usual process for testing the app on different devices before making it available for sale?
The android developer site confirms that you can upload your app without publishing to allow for final testing. See more information here: Publishing on Android Market (under "Configuring options and uploading assets" header). When you actually publish the app it should be up within minutes. See this answer as well Just uploaded Android App: How long before app shows in Android Market search?
Apple has a different approval which can take hours or weeks depending on how lucky you are :) I personally have not submitted an app for approval though so I don't know if there's a way to get approval and then delay the release. I don't have a dev account with Apple so I can't log in to see their app approval guidelines apparently, but maybe this has some useful info: iOS App Store Approval Guidelines