OGeek|极客世界-中国程序员成长平台

标题: ios - 如何从 Braintree iOs SDK 中获取 nonce [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:28
标题: ios - 如何从 Braintree iOs SDK 中获取 nonce

我正在尝试从 Braintree 获取 nonce。我没有在以下文档中找到 Braintree 提供的有关如何从 Braintree SDK 获取 nonce 的任何文档。

https://developers.braintreepayments.com/start/hello-client/ios/v4

请告诉我如何从 Braintree iOs SDK 中获取 nonce



Best Answer-推荐答案


您可以使用 drop in 方法获取 Payment nonce 让 nonce = result.paymentMethod!.nonce

示例:-

func showDropIn(clientTokenOrTokenizationKey: String) {
    let request =  BTDropInRequest()
    let dropIn = BTDropInController(authorization: clientTokenOrTokenizationKey, request: request)
    { (controller, result, error) in
        if (error != nil) {
            print("ERROR")
        } else if (result?.isCancelled == true) {
            print("CANCELLED")
        } else if let result = result {

            let nonce = result.paymentMethod!.nonce

            print( nonce)

        }
        controller.dismiss(animated: true, completion: nil)
    }
    self.present(dropIn!, animated: true, completion: nil)
}

关于ios - 如何从 Braintree iOs SDK 中获取 nonce,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35199248/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4