Hi!
I am working for a Financial Institution. We would like to give our customers the ability to add one of our credit or debit to their iOS device wallet, but only if the card has not been added to the device yet.
We have obtained the necessary entitlement fromApple, and I have reviewed the documentation that describes how to provision a credit or debit card for Apple Pay.
To start, we actually just want to add the "Add To Wallet" button next to our cards inside the mobile app. For that we, of course, want to check if the card was already added. The intention is to launch the Wallet via PKPassLibrary.OpenPaymentSetup() after that - no automatic adding of cards for now.
From the documentation provided to us by Apple, it seems obvious that I can invoke the following API call:
-[PKPassLibrary canAddPaymentPassWithPrimaryAccountIdentifier:]
Question 1: Can this be tested with one of Apple's sandbox card (provided here: https://developer.apple.com/apple-pay/sandbox-testing/) What I am essentially asking: can I add a sandbox card to the wallet for ApplePay and then get a "false" from the canAddPaymentPassWithPrimaryAccountIdentifier call for that sandbox card (since it was already added)?
Question 2: Is there a simple way to retrieve all current PKPaymentPasses for the device, or do I need to implement the entire process that generates the payload to instantiate a PKPaymentPass as in what I would need for the PKAddPaymentPassRequest call? I assume there is no shortcut to query the API for an already added card by PAN?
Question 3: Reading more about this topic, I found that I could potentially also use PKPassLibrary.containsPass(pass: PKPass). Again, I would have to pass an instance of PKPass. I assume that I can only do that with the fully generated payload as outlined in the documentation for the PKAddPaymentPassRequest call - is that correct?
I appreciate any help anybody can provide on this subject.