Migrating from card.io (iOS)

If you haven't already, follow the "Importing DyScan" steps in the General Integration Guide.

import DyScan in the file with the view controller that will instantiate DyScan. Unlike card.io, a bridging header is not necessary as DyScan is written in Swift.

Implement two functions, onFailure(_ paymentViewController: DyScanViewController!, reason: DyScanExitReason), and onSuccess(_ cardInfo:DyScanCreditCardInfo!, in paymentViewController: DyScanViewController!). These should be analogous to the corresponding functions with Card.io, except that the names have been modified and the failure case provides a reason that you may choose to use to give a more robust experience.

Make your view controller conform to DyScanViewControllerDelegate instead of CardIOPaymentViewControllerDelegate.

Replacing the instantiation and presentation of the CardIOPaymentViewController with

let scanVC = DyScanViewController() 
let navigationController = UINavigationController(rootViewController: scanVC) 
scanVC.paymentDelegate = self 
scanVC.apiKey = "{YOUR API KEY}" 
present(navigationController, animated: true, completion: nil)

DyScanCreditCardInfo is analogous to card.io's, but contains fewer methods. You can access the relevant fields by indexing cardNumber, expiryMonth, and expiryYear.

Last updated