如何从Braintree iOs SDK获取nonce

如何从Braintree iOs SDK获取nonce,ios,paypal,braintree,paypal-rest-sdk,Ios,Paypal,Braintree,Paypal Rest Sdk,我正试着从Braintree那里得到nonce。在下面的文档中,我没有找到任何关于如何从BraintreeSDK获取nonce的Braintree文档 请让我知道如何从Braintree iOs SDK获得nonce完整披露:我在Braintree工作。如果您有任何进一步的问题,请随时联系 获取nonce记录在您链接的页面的中。一旦插入处于活动状态,就需要实现一个委托,以便插入可以找到在何处发送它生成的临时值。如果没有指定的委托,您将无法从下拉列表中接收nonce: ​ 然后实现BTDropIn

我正试着从Braintree那里得到nonce。在下面的文档中,我没有找到任何关于如何从BraintreeSDK获取nonce的Braintree文档

请让我知道如何从Braintree iOs SDK获得nonce完整披露:我在Braintree工作。如果您有任何进一步的问题,请随时联系

获取nonce记录在您链接的页面的中。一旦插入处于活动状态,就需要实现一个委托,以便插入可以找到在何处发送它生成的临时值。如果没有指定的委托,您将无法从下拉列表中接收nonce: ​

然后实现BTDropInViewControllerDelegate,以在成功后立即获得付款方式,并在以下任一情况下关闭DropIn UI:


如果查看第一个函数,可以看到变量paymentMethodNonce type:BTPaymentMethodNonce被传递到应用程序中。此示例代码期望您拥有另一个函数postNonceToServer,以便在获得nonce后实际处理它

您可以通过使用 让nonce=result.paymentMethod!。暂时

示例:-

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)
}

第四版呢?在没有委托的情况下。@Pedro.Alonso新的Braintree iOS插件接受一个完成回调,该回调返回一个BTDropInResult对象,该对象包含支付方法nonce。披露:我在Braintreeh工作,如何将支付方式nonce转换为nssting@理查德Shin@JasonBTPaymentMethodNonce的nonce属性是一个NSString。@Raymond Berg:BTDropInViewControllerDelegate正在最新SDK中获取未解析的标识符
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)
}