When I attempt to present a PKPaymentAuthorizationController with present(completion: _)
it fails without any further information.
Here's how I'm presenting it:
let paymentSummaryItems: [PKPaymentSummaryItem] = <HIDDEN>
let paymentRequest = PKPaymentRequest()
paymentRequest.paymentSummaryItems = paymentSummaryItems
paymentRequest.merchantIdentifier = <HIDDEN>
paymentRequest.merchantCapabilities = .capability3DS
paymentRequest.countryCode = "US"
paymentRequest.currencyCode = "USD"
paymentRequest.supportedNetworks = [.visa, .amex, .masterCard, .discover]
paymentRequest.requiredShippingAddressFields = [.email]
let paymentController = PKPaymentAuthorizationController(paymentRequest: paymentRequest)
paymentController.delegate = self
paymentController.present { success in
if success {
print("Presented payment controller")
} else {
print("Failed to present payment controller")
}
}
Every time I try, I get the message "Failed to present payment controller", and no Apple Pay Authorization modal appears.
I added a PKPaymentAuthorizationController.canMakePayments()
check, and that returns true. I'm not sure what could be going wrong. The same code (with a different merchantIdentifier
) works in my other Apple Pay projects with no problems.