1.0.1 • Published 5 years ago

digitaltown-nativescript-card-io v1.0.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
5 years ago

nativescript-card-io

nativescript-card-io provides fast, easy credit card scanning in mobile apps.

Installation

Describe your plugin installation steps. Ideally it would be something like:

tns plugin add nativescript-card-io

Usage

import { CardIo } from 'nativescript-card-io';

let cardIo = new CardIo();

cardIo.scan({
    android: {
        requireExpiry: true,
        requireCvv: true,
        requirePostalCode: false,
        returnCardImage: true
    }
}).then((result: CreditCard) => {
    console.log("RESULT >>> ", result);
}, error => {
    console.log("ERROR >>> ", error);
});

API

scan(options): Promise;

Start the scanning process

Options format

Everything that has '?' is optional

Scan Options

PropertyDescription
android?: AndroidOptionSet Android Options
ios?: anySet iOS Options

Android Options

PropertyDefaultDescription
noCamera?: booleanDefaults to false.If set, the card will not be scanned with the camera.
requireExpiry?: booleanDefaults to false.If set to false, expiry information will not be required.
unblurDigits?: numberDefaults to -1 (no blur).How many of the Card number digits NOT to blur on the resulting image. Setting it to 4 will blur all digits except the last four.
scanExpiry?: booleanDefaults to true.If set to true, and requireExpiry is true, an attempt to extract the expiry from the card image will be made.
requireCvv?: booleanDefaults to false.If set, the user will be prompted for the card CVV.
requirePostalCode?: booleanDefaults to false.If set, the user will be prompted for the card billing postal code.
restrictPostalCodeToNumericOnly?: booleanDefaults to false.If set, the postal code will only collect numeric input. Set this if you know the expected country's postal code has only numeric postal codes.
requireCardholderName?: booleanDefaults to false.If set, the user will be prompted for the cardholder name.
suppressManualEntry?: booleanDefaults to false.Removes the keyboard button from the scan screen.
useCardioLogo?: booleanDefaults to false.If set, the card.io logo will be shown instead of the PayPal logo.
hideCardioLogo?: booleanDefaults to false.When set to true the card.io logo will not be shown overlaid on the camera.
languageOrLocale?: stringThe preferred language for all strings appearing in the user interface. If not set, or if set to null, defaults to the device's current language setting. Can be specified as a language code ("en", "fr", "zh-Hans", etc.) or as a locale ("en_AU", "fr_FR", "zh-Hant_TW", etc.).
usePaypalActionbarIcon?: booleanUse the PayPal icon in the ActionBar.
keepApplicationTheme?: booleanIf this value is set to true, and the application has a theme, the theme will be set to the theme of the application.
guideColor?: stringDefaults to green.Changes the color of the guide overlay on the camera.
suppressConfirmation?: booleanIf this value is set to true the user will not be prompted to confirm their card number after processing.
suppressScan?: booleanOnce a card image has been captured but before it has been processed, this value will determine whether to continue processing as usual.
returnCardImage?: booleanIf this value is set to true the card image will be return as ImageSource

Result Option

Credit Card

PropertyDescription
cardType: CardTypeGet Card CardType Details
formattedCardNumber: stringGet the formatted Card Number
lastFourDigitsOfCardNumber: stringGet the last Four Digit on the Card Number
redactedCardNumber: stringGet Redacted Card Number
isExpiryValid: booleanGet a boolean which indicate the validity of the Card
content: stringGet the Card Details

Card Type

PropertyDescription
cvvLength: numberGet cvv number length (4 for Amex, 3 for others, -1 for unknown)
displayName(languageOrLocale: string): stringGet the Card Display Name
imageBitmap: anyGet The ImageBitmap image after scan if returnCardImage is true
numberLength: numberGet Card Number Length e.g(15 for AmEx, -1 for unknown, 16 for others.)
content: stringGet Card Type Details

Author

Jonathan Mayunga, mayunga.j@gmail.com

License

Apache License Version 2.0, January 2004