The LEADTOOLS functions for scanning a credit card can be used to extract the credit card number, credit card type, and expiration date from a series of raster images (frames). In addition, from the analytics of the scanning session, a guide frame can be obtained which can be used to update the user interface of your application.
L_CC_CreateScanner must be called before calling any other LEADTOOLS Credit Card toolkit functions in order to create a handle to the credit card scanner session.
After creating a handle to the credit card scanner session, add frames to the scanner by calling L_CC_ScanFrame. Data is passed to the scanner session using the L_CC_Frame structure. In the L_CC_Frame structure, you provide raster image data as a L_UCHAR* buffer.
Each call to L_CC_ScanFrame will fill an L_CC_DetectionInfo structure with results from the scanner session. If the Status member is L_CC_ScanFrameStatus_MoreFramesNeeded, then you must provide more frames to the scanner session. Normally it will require more than one frame to get accurate results.
Obtaining good results for the expiration date sometimes requires even more frames. Scanning can continue, even after the Status member is L_CC_ScanFrameStatus_NumbersFound, as long as the ExpiryMonth and ExpiryYear are equal to 0.
Once the Status member is L_CC_ScanFrameStatus_NumbersFound, retrieve the credit card information from the scanner session by calling L_CC_ToCreditCard. This will convert the data from the L_CC_DetectionInfo structure into a L_CC_CreditCard structure, which holds the card number, expiration date and credit card type.
L_CC_GetScannerAnalytics gets the current analytic information from the credit card scanner session.
L_CC_GetGuideFrame gets the guide frame based on the frame orientation. The guide frame can be used to update the user interface of your application in order to help the end-user properly position the frame for scanning.
L_CC_ResetScanner resets the credit card scanner session. Reset the session if you have previously obtained good results and you would like to start over using the same session handle.
When the handle to the scanner session is no longer needed, free it by calling L_CC_DestroyScanner.
For a complete example, refer to the CreditCardCapture demo.