Stripe Implementation problem on Swift 5. Please help.

If anyone can help me with this i would be forever in your debt. I was following tutorial on how to create an app on Swift 3 and unfortunately I worked with swift 5, and as i went I would troubleshoot and fix issues but in this case I am doumb founded. The error does not trigger on Swift 3 so I assume something happened between the versions. In this task I am trying to implement Stripe into the app.


The error I get is from "card": Cannot convert value of type 'STPPaymentMethodCardParams' to expected argument type 'STPCardParams'


STPAPIClient.shared().createToken(withCard: card, completion: { (token, error) in



This is an inside view on my PaymentViewController.


import UIKit
import Stripe

class PaymentViewController: UIViewController {
    
    @IBOutlet weak var cardTextField: STPPaymentCardTextField!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Do any additional setup after loading the view.
    }
    
    @IBAction func placeOrder(_ sender: AnyObject) {
        
        APIManager.shared.getLatestOrder { (json) in
            
            if json["order"]["status"] == nil || json["order"]["status"] == "Delivered" {
                // Processing the payment and create an Order
                
                let card = self.cardTextField.cardParams
                
                STPAPIClient.shared().createToken(withCard: card, completion: { (token, error) in
            
        

                    if let myError = error {
                        print("Error:", myError)
                    } else if let stripeToken = token {
                        
                        APIManager.shared.createOrder(stripeToken: stripeToken.tokenId) { (json) in
                            Cart.currentCart.reset()
                            self.performSegue(withIdentifier: "ViewOrder", sender: self)
                        }
                    }
                })
                
            } else {
                // Showing an alert message.
                
                let cancelAction = UIAlertAction(title: "OK", style: .cancel)
                let okAction = UIAlertAction(title: "Go to order", style: .default, handler: { (action) in
                    self.performSegue(withIdentifier: "ViewOrder", sender: self)
                })
                
                let alertView = UIAlertController(title: "Already Order?", message: "Your current order isn't completed", preferredStyle: .alert)
                
                alertView.addAction(okAction)
                alertView.addAction(cancelAction)
                
                self.present(alertView, animated: true, completion: nil)
            }
        }
        
    }
}


Anyone have experience with this issue??

That is not an XCode issue.


Should ask the question on Stripe forum.


Did you look at this:

https://stackoverflow.com/questions/57199079/cannot-assign-value-of-type-stppaymentmethodcardparams-to-type-stpcardparams

Stripe Implementation problem on Swift 5. Please help.
 
 
Q