Reputation: 337
I am using applePay and everything is working fine. It launches in the sandbox environment on simulator(not supported for devices in my country) and upon clicking pay with passCode comes to the delegate method of Passkit didAuthorizeViewController. Here is my code
func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) {
let token = payment.token
let paymentData = token.paymentData
}
The issue is that paymentData returns empty. token is encrypted info as per applepay documentation and returns count 0 of `token.paymentData'. and i have no idea why its not returning anything. i couldn't find much on stack or developer's forum of apple about this. I have already enabled merchant capablities to .3DS. Already spent hours to no avail.
Upvotes: 3
Views: 1573
Reputation: 727
To get token you need to run this code on real device, simulator always returns nil.
Upvotes: 3