Register Card

Albert Mata edited this page Nov 3, 2016 · 5 revisions
    func createCardTokenOperation() {
        guard let ref = Reference(consumerRef: self.reference) else { return }
        try! self.judoKitSession.invokeRegisterCard(judoId, amount: Amount(decimalNumber: 0.01, currency: currentCurrency), reference: ref, completion: { (response, error) -> () in
            self.dismiss(animated: true, completion: nil)
            if let error = error {
                if error.code == .userDidCancel {
                    self.dismiss(animated: true, completion: nil)
                    return
                }
                var errorTitle = "Error"
                if let errorCategory = error.category {
                    errorTitle = errorCategory.stringValue()
                }
                self.alertController = UIAlertController(title: errorTitle, message: error.message, preferredStyle: .alert)
                self.alertController!.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
                self.dismiss(animated: true, completion:nil)
                return // BAIL
            }
            if let resp = response, let transactionData = resp.items.first {
                self.cardDetails = transactionData.cardDetails
                self.paymentToken = transactionData.paymentToken()
            }
            })
    }

Note: Please make sure that you are using a unique Consumer Reference for each different consumer.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.