【问题标题】:PKAddPaymentPassViewControllerDelegate methods implementationsPKAddPaymentPassViewControllerDelegate 方法实现
【发布时间】:2020-01-22 10:45:37
【问题描述】:

我们必须将 App 中的借记卡/信用卡添加到 Apple Wallet

let config = PKAddPaymentPassRequestConfiguration.init(encryptionScheme: PKEncryptionScheme.ECC_V2)
config?.cardholderName = "John"
config?.primaryAccountSuffix = "9999" //last 4 or 5digits of card
config?.localizedDescription = "This will add the card to Apple Pay";
config?.primaryAccountIdentifier = "test";
config?.paymentNetwork = PKPaymentNetwork(rawValue: "VISA");

guard let addPaymentPassVC = PKAddPaymentPassViewController.init(requestConfiguration: config!, delegate: self) else { return }
self.present(addPaymentPassVC, animated: true, completion: nil)


extension ViewController: PKAddPaymentPassViewControllerDelegate {
    func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, 
generateRequestWithCertificateChain certificates: [Data], 
nonce: Data, 
nonceSignature: Data, 
completionHandler handler: @escaping (PKAddPaymentPassRequest) -> Void) {



    }

    func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, 
didFinishAdding pass: PKPaymentPass?, 
error: Error?) {

        print("didFinishAdding")

    }


}


PKAddPaymentPassViewControllerDelegate 方法应该如何实现?

【问题讨论】:

    标签: swift applepay


    【解决方案1】:

    我认为首先,您应该查看 Apple 的 PassKit 文档以正确理解它的工作原理 (https://developer.apple.com/wallet/)。那么也许这个网站适合你:https://github.com/tschoffelen/php-pkpass

    但在您直接与苹果交谈并获得他们的许可之前,您无法做任何事情。

    【讨论】:

      猜你喜欢
      • 2014-09-07
      • 2022-01-16
      • 2020-04-08
      • 2016-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-15
      相关资源
      最近更新 更多