When I try Apple Pay sandbox payment, it returns "Payment not completed".

        let paymentRequest:PKPaymentRequest = PKPaymentRequest()
        let label = selectedTier == 0 ? "Tier 0 Membership" : "Tier 1 Membership"
        let amount = selectedTier == 0 ? NSDecimalNumber(value: 99.0) : NSDecimalNumber(value: 189.0)
        let summary1 = PKPaymentSummaryItem(label: label, amount: amount, type: .final)
        let total = PKPaymentSummaryItem(label: "total", amount: amount, type: .final)
        paymentRequest.paymentSummaryItems = [summary1, total]
        paymentRequest.supportedNetworks = [.visa, .masterCard, .amex, .discover]
        paymentRequest.merchantCapabilities = [.capability3DS, .capabilityEMV, .capabilityDebit, .capabilityCredit]
        paymentRequest.currencyCode = "USD"
        paymentRequest.countryCode = "US"
        paymentRequest.merchantIdentifier = APPLEPAY_MERCHANTID
        paymentRequest.applicationData = "ID:123456" .data(using: .utf8)
        guard let authorizationVC:PKPaymentAuthorizationViewController = PKPaymentAuthorizationViewController(paymentRequest: paymentRequest) else{
            return
        }
        authorizationVC.delegate = self
        let delay = DispatchTime.now() + .milliseconds(300)
        DispatchQueue.main.asyncAfter(deadline: delay) {
            self.present(authorizationVC, animated: true, completion: nil)
        }


As title post, When I intergrated the Apple Pay, I got some trouble and can not continue.


func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, handler completion: @escaping (PKPaymentAuthorizationResult) -> Void)


the delegate didAuthorizePayment never callback, and when I entered passcode to confirm the payment, it always shows that "Payment Not Completed". And I got no error, so what can I go on ...

Replies

Bad news, seems no official technical support guys would like to answer questions here ~~~