I have implemented apple pay in my iOS application using Passkit framework. I did all of these things fully to set up apple pay. I am using sandbox account. I added
Recently I faced the same issue and I found a solution.
Everything is fine only we have to update the handler with the success or failure like this:
func paymentAuthorizationViewController(_ controller:
PKPaymentAuthorizationViewController, didAuthorizePayment payment:
PKPayment, handler completion: @escaping
(PKPaymentAuthorizationResult) -> Void) {
If the payment data are nil or not check for simulator always its nil :
do {
let jsonResponse = try JSONSerialization.jsonObject(with: paymentStatus.paymentData, options: .mutableContainers)
print(jsonResponse as! NSDictionary)
completion(PKPaymentAuthorizationResult(status: .success, errors: nil))
}
catch let error
{
print(error)
completion(PKPaymentAuthorizationResult(status: .failure, errors: nil))
}
It should solve the problem.