Card IO
Repo: https://github.com/card-io/card.io-Cordova-Plugin
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add card.io.cordova.mobilesdk $ npm install --save @ionic-native/card-io@4
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
Usage
This plug-in exposes card.io credit card scanning.
NOTE: If you would like to actually process a credit card charge, you might be interested in the PayPal Cordova Plug-in.
Requires Cordova plugin: card.io.cordova.mobilesdk
. For more info, please see the Card IO plugin docs.
Note: For use with iOS 10 + When building your app with the iOS 10 SDK +, you have to add some info to the info.plist file. This is due to increased security in iOS 10. Go to your app directory and search for the
Returns: Options for configuring the pluginOptional
Returns:
Returns: Set to true to require expiry date The user will be prompted for the card CVV The user will be prompted for the card billing postal code. Removes the keyboard button from the scan screen. The postal code will only collect numeric input. Set this if you know the expected country's postal code has only numeric postal codes. The theme for the card.io Activity's will be set to the theme of the application. The user will be prompted for the cardholder name Used to display instructions to the user while they are scanning their card. If set, the card will not be scanned with the camera. If scanExpiry is true, an attempt to extract the expiry from the card image will be made. The 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. Changes the color of the guide overlay on the camera. The color is provided in hexadecimal format (e.g. The user will not be prompted to confirm their card number after processing. The card.io logo will not be shown overlaid on the camera. The card.io logo will be shown instead of the PayPal logo. Once a card image has been captured but before it has been processed, this value will determine whether to continue processing as usual. Card type Masked card number, showing only last 4 digits Full card number Expiry month Expiry year CVV Postal code Cardholder name<key>NSCameraUsageDescription</key>
<string>To scan credit cards.</string>
import { CardIO } from '@ionic-native/card-io';
constructor(private cardIO: CardIO) { }
...
this.cardIO.canScan()
.then(
(res: boolean) => {
if(res){
let options = {
requireExpiry: true,
requireCVV: false,
requirePostalCode: false
};
this.cardIO.scan(options);
}
}
);
Instance Members
Check whether card scanning is currently available. (May vary by
device, OS version, network connectivity, etc.)
canScan()
Promise<boolean>
Scan a credit card with card.io.
scan(options)
Param
Type
Details
options
CardIOOptions
Promise<any>
Retrieve the version of the card.io library. Useful when contacting support.
version()
Promise<string>
CardIOOptions
Param
Type
Details
requireExpiry
boolean
requireCVV
boolean
requirePostalCode
boolean
suppressManual
boolean
restrictPostalCodeToNumericOnly
boolean
keepApplicationTheme
boolean
requireCardholderName
boolean
scanInstructions
string
noCamera
boolean
scanExpiry
boolean
languageOrLocale
string
guideColor
string | number
#FFFFFF
)
supressConfirmation
boolean
hideCardIOLogo
boolean
useCardIOLogo
boolean
supressScan
boolean
CardIOResponse
Param
Type
Details
cardType
string
redactedCardNumber
string
cardNumber
string
expiryMonth
number
expiryYear
number
cvv
string
postalCode
string
cardholderName
string