Unable to Retrieve Existing Card Status from Apple Wallet

Hi,

We are able to successfully perform in-app provisioning and add cards to the native wallet. However, we are unable to retrieve the existing card status from the wallet.

Even when the card is already added to the device or Apple Watch, the status is always returning as false for both.

Could you please let us know if there are any additional configurations, entitlements, or issuer onboarding steps required to retrieve the existing card status from Apple Wallet?

Answered by DTS Engineer in 892671022

Hi @Manikandan1981,

You wrote:

Could you please let us know if there are any additional configurations, entitlements, or issuer onboarding steps required to retrieve the existing card status from Apple Wallet?

As a first step, please confirm your app's .entitlements file includes the approved in-app provisioning entitlement (com.apple.developer.payment-pass-provisioning).

Next, the most common mistake is using the wrong API to check for card status. For iOS, see the following example:

let library = PKPassLibrary()

// Check if a specific card can be added (returns false, if already present)
let canAdd = PKAddPaymentPassViewController.canAddPaymentPass(
    withPrimaryAccountIdentifier: "YOUR_PAI"
)

// Retrieve existing payment passes provisioned by your app
let existingPasses = library.passes(of: .secureElement)
    .compactMap { $0 as? PKPaymentPass }
    .filter { $0.primaryAccountIdentifier == "YOUR_PAI" }

For watchOS, see the following example:

// Check remote (paired Apple Watch) status
let canAddToWatch = library.canAddPaymentPass(
    withPrimaryAccountIdentifier: "YOUR_PAI"
)

// Retrieve watchOS passes
let remotePasses = library.remotePaymentPasses()
    .filter { $0.primaryAccountIdentifier == "YOUR_PAI" }

If you are using the API above and still not receiving the card status, see below for some of the root causes:

  • The primary account identifier used in the status check must exactly match the value returned during the provisioning flow by your card issuer/PSP/TSP.
  • The primary account identifier is case-sensitive and must be consistent across your backend and the PassKit and Wallet APIs.
  • Verify the primary account identifier you're querying against by logging pass.primaryAccountIdentifier on passes returned from library.passes(of: .secureElement).

It's good to know that the PKPassLibrary only returns passes provisioning by your own app (matched by Team ID + entitlement). If the card was previously added via:

  • a different app (e.g., the issuer's older app)
  • the Add Card flow in Apple Wallet directly
  • a different Team ID build

Then, passes(of: .secureElement) will not return those passes in your issuer app. You then must rely on canAddPaymentPass(withPrimaryAccountIdentifier:) returning false as an indirect signal that the card already exists.

Lastly, it's also useful to confirm if you're running in the sandbox or production environments when these results occur.

Cheers,

Paris X Pinkney |  WWDR | DTS Engineer

Hi @Manikandan1981,

You wrote:

Could you please let us know if there are any additional configurations, entitlements, or issuer onboarding steps required to retrieve the existing card status from Apple Wallet?

As a first step, please confirm your app's .entitlements file includes the approved in-app provisioning entitlement (com.apple.developer.payment-pass-provisioning).

Next, the most common mistake is using the wrong API to check for card status. For iOS, see the following example:

let library = PKPassLibrary()

// Check if a specific card can be added (returns false, if already present)
let canAdd = PKAddPaymentPassViewController.canAddPaymentPass(
    withPrimaryAccountIdentifier: "YOUR_PAI"
)

// Retrieve existing payment passes provisioned by your app
let existingPasses = library.passes(of: .secureElement)
    .compactMap { $0 as? PKPaymentPass }
    .filter { $0.primaryAccountIdentifier == "YOUR_PAI" }

For watchOS, see the following example:

// Check remote (paired Apple Watch) status
let canAddToWatch = library.canAddPaymentPass(
    withPrimaryAccountIdentifier: "YOUR_PAI"
)

// Retrieve watchOS passes
let remotePasses = library.remotePaymentPasses()
    .filter { $0.primaryAccountIdentifier == "YOUR_PAI" }

If you are using the API above and still not receiving the card status, see below for some of the root causes:

  • The primary account identifier used in the status check must exactly match the value returned during the provisioning flow by your card issuer/PSP/TSP.
  • The primary account identifier is case-sensitive and must be consistent across your backend and the PassKit and Wallet APIs.
  • Verify the primary account identifier you're querying against by logging pass.primaryAccountIdentifier on passes returned from library.passes(of: .secureElement).

It's good to know that the PKPassLibrary only returns passes provisioning by your own app (matched by Team ID + entitlement). If the card was previously added via:

  • a different app (e.g., the issuer's older app)
  • the Add Card flow in Apple Wallet directly
  • a different Team ID build

Then, passes(of: .secureElement) will not return those passes in your issuer app. You then must rely on canAddPaymentPass(withPrimaryAccountIdentifier:) returning false as an indirect signal that the card already exists.

Lastly, it's also useful to confirm if you're running in the sandbox or production environments when these results occur.

Cheers,

Paris X Pinkney |  WWDR | DTS Engineer

When you provision the card from your app, make sure you pass the correct appId which should include your Team Id. Without it, you will not be able to fetch your cards from the wallet as there will be no association.

Unable to Retrieve Existing Card Status from Apple Wallet
 
 
Q