Post

Replies

Boosts

Views

Activity

Reply to PKPassLibrary passes() is giving empty response
Forgive the formality of this post, but I wanted to ensure this was explained as thoroughly as I could. Our team ran into this very issue and found little documentation on a fix. Through trial and error here is what we came up with: Issue Overview During in-app provisioning for Apple Wallet, we encountered an issue where, despite a successful provisioning process, the app could not detect the newly added debit/credit card in the PKPassLibrary. Specifically, we were validating the card by checking the primaryAccountNumberSuffix on the returned pass object. However, the returned suffix had an unexpected "x" prefix, which resulted in a false pass detection. Additionally, we needed to ensure that all metadata was correctly configured on our card provider's (Visa) side, especially regarding the associatedApplicationIdentifiers key, which allows the app to properly access and manage the issuer’s payment passes. Problem Details False Pass Detection: We were relying on primaryAccountNumberSuffix for verifying the presence of the newly provisioned card in the wallet. Our expectation was that the suffix would be a direct match with the card's actual suffix. However, in some cases, an "x" prefix was added to the suffix returned by the provisioning process, which caused our comparison logic to fail, and the pass was falsely marked as "not present." Metadata Misconfiguration: In addition to the suffix mismatch, we had to ensure that the metadata for our Visa card provider was correctly configured. Specifically, the associatedApplicationIdentifiers key needed to be verified and aligned with the App ID in App Store Connect. Fixes Implemented Handling the Suffix Mismatch: We updated our logic for checking the primaryAccountNumberSuffix to account for the potential "x" prefix in the returned value. This allowed our validation step to work even when the prefix was present, thus correctly identifying the card in the wallet. Metadata Updates (Visa): The associatedApplicationIdentifiers key plays a crucial role in enabling the app to see, access, and manage the issuer's payment passes. We ensured that the following details were correctly configured for this key: The App ID was accurately provided from App Store Connect, consisting of: Team ID (provided by Apple, unique to our development team). Bundle ID (specific to the app) formatted as TeamID.BundleID. Ensuring this information was up-to-date allowed the app to interact with the card passes as expected. Outcome With these fixes in place: The app can now successfully detect and display the newly added debit/credit card in the Apple Wallet. The validation process accounts for variations in the primaryAccountNumberSuffix, avoiding false pass detections. Correctly configured metadata ensures the app can manage and activate the payment passes seamlessly.
Sep ’24