Adding PassKit Suppression

The SmartSpacesKit works with hardware which may contain an NFC reader. When you bring your iPhone close to the NFC reader the Apple Wallet application will be automatically triggered and open. If this seriously disturbs you or your customers, you can suppress the triggering of the Apple Wallet. To do this you need to follow these steps:

Step 1. Request Entitlement for suppressing Apple Pay

Send request to: apple-pay-provisioning@apple.com.

Suggestion:

Our company provides an app for access and IoT smart home functionalities.
Our app interacts with custom hardware to authenticate users and allow them to open doors to secure areas. The custom hardware uses both Bluetooth and NFC technology.
The integrated NFC reader in our custom hardware enables those users without a smartphone to authenticate at our readers via NFC chips.
With the mobile app we offer the users a tap functionality to trigger a reaction (i.e. a door opening request) when the Bluetooth signal is seen above a specified RSSI threshold. To achieve this threshold the user needs to hold their iOS device against our custom hardware with our app in the foreground.
The problem that we are continuously confronted with is that this action also triggers Apple Pay due to proximity of the NFC reader, although the user is not intending to buy anything. It creates a poor user experience and it appears to the user that we want to charge them to open the door.

If you successfully get permission from Apple, you will see the following option in the Apple Developer Portal when you create a Provision Profile:

Step 2. Create a Provision Profile

In order to use Apple Pay suppression, you need to create a Provision Profile with the Apple Pay suppression entitlements.

Make sure you download the updated profile with the entitlement and Xcode knows about it.

Step 3. Add entitlements to your app

If you already have the entitlements file, skip this. A quick way to add an empty entitlements file is to go to the Signing & Capabilities tab and enable a capability, then remove it. Go to on the Build Settings tab, find Code Signing Entitlements and specify the name of the added entitlements file. Apple’s documentation.

Add a new row with com.apple.developer.passkit.pass-presentation-suppression to the entitlements file and set its value to Boolean, YES.

Step 4. Add the PassKit framework to your app

Set it to an optional value if you expect your code to work on devices that don’t have PassKit.

Step 5. Add a few lines into your code

import UIKit
import PassKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var suppressionRequestToken: PKSuppressionRequestToken?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        activate(applePaySuppression: true)

        return true
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        activate(applePaySuppression: true)
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
        activate(applePaySuppression: false)
    }

    func activate(applePaySuppression activate: Bool) {
        if PKPassLibrary.isPassLibraryAvailable() {
            if activate {
                suppressionRequestToken = PKPassLibrary.requestAutomaticPassPresentationSuppression(responseHandler: { result in
                    print("Request automatic pass presentation suppression result: \(result)")
                    // TODO: handle your result
                })
            } else {
                guard let suppressionRequestToken = suppressionRequestToken else {
                    return
                }

                PKPassLibrary.endAutomaticPassPresentationSuppression(withRequestToken: suppressionRequestToken)
                self.suppressionRequestToken = nil
            }
        }
    }

}

If you did everything right, you will see a message from the system the first time you start an application: Payment cards and passes in Wallet will not work automatically while “YOUR APP NAME” is in use.