Searching Apple Pay / Passkit / Wallet documentation, I've found very few code examples and pretty poor documentation. We're attempting to present a payment pass we've provisioned rather than just launch the wallet with openPaymentSetup()
.
According to PKPassLibrary
docs, this can be achieved with PKPassLibrary.present()
. We're invoking this function and it launches Apple Pay directly into the add a card wizard, which seems worse than the UX from openPaymentSetup()
.
The code we're using is:
let library: PKPassLibrary = PKPassLibrary()
let passes: [PKPass] = library.remotePaymentPasses()
if !passes.isEmpty, #available(iOS 10.0, *) {
library.present(passes[passes.count-1].paymentPass!)
} else {
library.openPaymentSetup()
}
We get the pass library and our passes, then conditionally attempt to present the last pass.
Does anyone know how to show a pass rather than launching a tutorial or add a card wizard?
passTypeIdentifier
matching your type. – Mike Taverne