I am adding In-App provisioning to my app. I am able to access the Apple Pay Sandbox and I have successfully tested adding a secure element/payment pass to Apple Wallet. However, once the pass has been added to the wallet, I can not access or retrieve the pass from my app. I have confirmed with the PNO that the PNO Pass Metadata Configuration in the testing environment include the correct metadata for "associatedApplicationIdentifiers" and "associatedStoreIdentifiers".
Does anyone know why I am having this issue and how I can resolve it?
Steps used to access pass in Apple Wallet
I am unable to view the pass when I attempt to access it using the PKPassLibrary
function as follows:
let library = PKPassLibrary()
if #available(iOS 13.4, *) {
// This returns an empty array
library.passes(of: .secureElement)
} else {
// This also returns an empty array
library.passes(of: .payment)
}
// This returns an empty array too
library.passes()
Steps used to add pass to Apple Wallet
These are the steps I follow to add the card:
- I create a
PKAddPaymentPassRequestConfiguration
- I use this config to instantiate a
PKAddPaymentPassViewController.
- I provide the
nonce
,nonceSignature
, andcertificates
to my PNO along with the card data. - I receive the
activationData
,encryptedPassData
, andephemeralPublicKey
from my PNO and create aPKAddPaymentPassRequest
using this data. - I add the pass to Apple Wallet.
In the addPaymentPassViewController
callback, I am able to view the pass data from the .didFinishAdding pass: PKPaymentPass?
variable. I am also able to see that the pass has been added from Apple Wallet app. I am not able to access the pass using PKPassLibrary().passes()
at this point. I am not able to access the pass at any point after adding it either.
If anyone else has this problem, the solution turned out to be relatively simple. The card we were using to test had incorrect metadata attached to it and therefore our card did not have the associatedApplicationIdentifiers set correctly. If you have the "Getting Started with Apple Pay In-App Provisioning, Verification & Security (3.0)" document, see section 5.4. "PNO Pass Metadata Configuration" for more information.