Request / Get contactless payment permissions

Dear,

I am starting to read the documentation about HCE payments and doing the first tests in my device. I have noticed that the only way to request contactless payment permissions is calling:

NFCPresentmentIntentAssertion.acquire()

And if it is the first time will prompt a popup asking the permissions and if not and the user denied the permission will throw the error systemEligibilityFailed.

My doubt is, is there other way to ask the contactless permissions instead of using the acquire? Because I understand that the acquire method is mainly created to prevent the default contactless app from launching. So I assume that it is not a good practice to use some point in the app just for asking the permission, right? Or for the first time we can use it for that purpose?

According to that, is there any way to get the current contactless payment permissions status, just as we can get it from the camera (AVCaptureDevice.authorizationStatus(for: mediaType: AVMediaType))?

The main goal is to give to the user a good experience. First asking the permission in a specific screen that explain why we need this permission and if the user denies it show some information in a screen as we can do it with other services as camera, micro, location...

Thank you

Answered by Engineer in 823281022

I can't speak to what App Review will think about this or do, but if your use case demands that the permission dialog gets out of the way before the first transaction occurs, then there is no other choice.

It is not ideal because it might confuse your users more, when they see NFC activity out of nowhere. Perhaps more than having to have one extra tap at the time of the transaction - which will make them understand what they are giving a permission for.

At this time, it is not possible to separate the permission prompt from an actual card transaction. You don't necessarily need to use .acquire(), and can just start a CardSession as well, but anything else you do will bring up the NFC UI at the same time, so it would be more confusing to the users.

At least tying the permission prompt to the presentment intent makes sense, as the user will be clear about what they are giving permission for.


Argun Tekant /  DTS Engineer / Core Technologies

But, can we use the acquire in an onboarding screen outside the card payment process? I mean, just for asking the permission. I have tried something like this:

class OnboardingPaymentScreenVC: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        configure()
        
        askPermissionButton.setTitle("Ask for contactless payment permission", for: .normal)
        askPermissionDescription.text = "This will allow you to pay with our app using your contactless card."
        askPermissionButton.addTarget(self, action: #selector(askPermissionAction), for: .touchUpInside)
    }
    
    @objc func askPermissionAction() {
    
        Task() {
            do {
                let _ = try await NFCPresentmentIntentAssertion.acquire()

                // Manage permission granted
                
            } catch let error {

                if let hceError = error as? NFCPresentmentIntentAssertion.Error {
                    switch hceError {
                    case .systemEligibilityFailed: break
                        // Manage permission denied
                    case .systemNotAvailable:
                        print("Error PRESENT: \(hceError)")
                    @unknown default:
                        print("Error PRESENT: \(hceError)")
                    }
                }
            }
        }
    }
}

It works as I expected but I do not know if it is a bad practice and it could be considered as cause of rejecting the app in the review process to de Apple Store.

Thank yo so much

Accepted Answer

I can't speak to what App Review will think about this or do, but if your use case demands that the permission dialog gets out of the way before the first transaction occurs, then there is no other choice.

It is not ideal because it might confuse your users more, when they see NFC activity out of nowhere. Perhaps more than having to have one extra tap at the time of the transaction - which will make them understand what they are giving a permission for.

From the official documentation :

https://developer.apple.com/support/hce-transactions-in-apps/

Important: Use of the intent assertion API outside of the presentment intent, or abuse of this API for unsupported use cases, is against Apple policy and could result in being blocked from installation from the App Store or through alternative app marketplaces.

Request / Get contactless payment permissions
 
 
Q