Hi,
please use config.primaryAccountIdentifier = self.getCardFPAN(panNumberSuffix)
use below method to get FPAN ID.
func getCardFPAN(_ cardSuffix: String?) -> String? {
let passLibrary = PKPassLibrary()
var paymentPasses = passLibrary.passes(of: .payment)
for pass in paymentPasses {
let paymentPass = pass.paymentPass
if paymentPass?.primaryAccountNumberSuffix == cardSuffix {
return paymentPass?.primaryAccountIdentifier
}
}
if WCSession.isSupported() {
// check if the device support to handle an Apple Watch
let session = WCSession.default
session.activate()
if session.isPaired {
// Check if the iPhone is paired with the Apple Watch
paymentPasses = passLibrary.remotePaymentPasses()
for pass in paymentPasses {
let paymentPass = pass.paymentPass
if paymentPass?.primaryAccountNumberSuffix == cardSuffix {
return paymentPass?.primaryAccountIdentifier
}
}
}
}
return nil
}
Topic:
App & System Services
SubTopic:
Apple Pay
Tags: