IOS:card.io use

Source: Internet
Author: User

Recent projects to use a function: by scanning the bank card, to obtain the bank card number, after the online search, chose the Card.io this SDK, the process is as follows:
(1) Download Card.io
Card.io is a phone camera to get credit card information, the middle of the use of OCR (optical character recognition) scanning technology to return results, it also launched the SDK (software Development Kit), so that developers can add card.io to their own applications. The latest SDK can be downloaded from Https://github.com/paypal/PayPal-iOS-SDK
(2) Add to Project
1, drag the downloaded SDK package named Cardio to the project, in Targets-build Phases-link Binary with Librarys Add the following dependent library
* Audiotoolbox
* Avfoundation
* Coregraphics
* CoreMedia
* Corevideo
* Foundation
* Mobilecoreservices
* Opengles
* Quartzcore
* Security
* UIKit
If it is a XCODE5 or an updated version, just add the following library
* Avfoundation
* Audiotoolbox
* CoreMedia
* Mobilecoreservices
And make sure that both of the build settings are yes:
* Enable Modules (C and Objective-c)
*link Frameworks automatically

2. Add-lc++ to other Linker Flags in Targets-build settings

(3) Use
I'm using it as a Viewcontroller class
Code:
Import

#import "CardIO.h" #import "CardIOPaymentViewControllerDelegate.h" - (void) Viewwillappear: (BOOL) Animated {[SuperViewwillappear:animated]; [Cardioutilities preload];}//Start scanning- (ibaction) Scancard: (IDSender {Cardiopaymentviewcontroller *scanviewcontroller = [[Cardiopaymentviewcontroller alloc] Initwithpaymentdelegate: Self]; [ SelfPresentviewcontroller:scanviewcontroller Animated:YESCompletion:Nil];} Here is the Proxy method//Cancel Scan- (void) Userdidcancelpaymentviewcontroller: (Cardiopaymentviewcontroller *) Scanviewcontroller {NSLog(@"User canceled payment Info");//Handle user cancellation here ...[Scanviewcontroller dismissviewcontrolleranimated:YESCompletion:Nil];}//Scan complete-(void) Userdidprovidecreditcardinfo: (cardiocreditcardinfo *) Info inpaymentviewcontroller: (Cardiopaymentviewcontroller * ) Scanviewcontroller {//Scan results//cardiocreditcardinfo *info contains some information about the bank card, If Info.cardnumber is a scanned bank card number, the reality is the full number, and Info.redactedcardnumber only show the bank card after four, the front with * instead of, the return of the bank card number no spaceYou can add a space using the following comment method//NSString *strtem = [Info.cardnumber stringbyreplacingoccurrencesofstring:@ "" withstring:@ ""];//NSString *strtem2 = @ "";//if (strtem.length% 4 = = 0)//    {//int count = STRTEM.LENGTH/4;//for (int i = 0; i < count; i++)//        {//NSString *str = [Strtem substringwithrange:nsmakerange (i * 4, 4)];//strTem2 = [strTem2 stringbyappendingstring:[nsstring stringwithformat:@ "%@", str]];//        }//    }//Else//    {//int count = STRTEM.LENGTH/4;//for (int j = 0; J <= Count; j + +)//        {//if (j = = count)//            {//NSString *str = [Strtem substringwithrange:nsmakerange (J * 4, Strtem.length% 4)];//strTem2 = [strTem2 stringbyappendingstring:[nsstring stringwithformat:@ "%@", str]];//            }//Else//            {//NSString *str = [Strtem substringwithrange:nsmakerange (J * 4, 4)];//strTem2 = [strTem2 stringbyappendingstring:[nsstring stringwithformat:@ "%@", str]];//            }//        }//    }  NSLog(@"Received card info. Number:%@, expiry:%02i/%i, CVV:%@. ", info. Redactedcardnumber, info. Expirymonth, info. Expiryyear, info. CVV);//Use the card info ...[Scanviewcontroller dismissviewcontrolleranimated:YESCompletion:Nil];}

IOS:card.io use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.