UNPKG

3.97 kBTypeScriptView Raw
1export interface CardIOOptions {
2 /**
3 * Set to true to require expiry date
4 */
5 requireExpiry?: boolean;
6 /**
7 * The user will be prompted for the card CVV
8 */
9 requireCVV?: boolean;
10 /**
11 * The user will be prompted for the card billing postal code.
12 */
13 requirePostalCode?: boolean;
14 /**
15 * Removes the keyboard button from the scan screen.
16 */
17 supressManual?: boolean;
18 /**
19 * The postal code will only collect numeric input. Set this if you know the expected country's postal code has only numeric postal codes.
20 */
21 restrictPostalCodeToNumericOnly?: boolean;
22 /**
23 * The theme for the card.io Activity's will be set to the theme of the application.
24 */
25 keepApplicationTheme?: boolean;
26 /**
27 * The user will be prompted for the cardholder name
28 */
29 requireCardholderName?: boolean;
30 /**
31 * Used to display instructions to the user while they are scanning their card.
32 */
33 scanInstructions?: string;
34 /**
35 * If set, the card will not be scanned with the camera.
36 */
37 noCamera?: boolean;
38 /**
39 * If scanExpiry is true, an attempt to extract the expiry from the card image will be made.
40 */
41 scanExpiry?: boolean;
42 /**
43 * 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.
44 */
45 languageOrLocale?: string;
46 /**
47 * Changes the color of the guide overlay on the camera. The color is provided in hexadecimal format (e.g. `#FFFFFF`)
48 */
49 guideColor?: string;
50 /**
51 * The user will not be prompted to confirm their card number after processing.
52 */
53 supressConfirmation?: boolean;
54 /**
55 * The card.io logo will not be shown overlaid on the camera.
56 */
57 hideCardIOLogo?: boolean;
58 /**
59 * The card.io logo will be shown instead of the PayPal logo.
60 */
61 useCardIOLogo?: boolean;
62 /**
63 * Once a card image has been captured but before it has been processed, this value will determine whether to continue processing as usual.
64 */
65 supressScan?: boolean;
66}
67export interface CardIOResponse {
68 /**
69 * Card type
70 */
71 cardType: string;
72 /**
73 * Masked card number, showing only last 4 digits
74 */
75 redactedCardNumber: string;
76 /**
77 * Full card number
78 */
79 cardNumber: string;
80 /**
81 * Expiry month
82 */
83 expiryMonth: number;
84 /**
85 * Expiry year
86 */
87 expiryYear: number;
88 /**
89 * CVV
90 */
91 cvv: string;
92 /**
93 * Postal code
94 */
95 postalCode: string;
96 /**
97 * Cardholder name
98 */
99 cardholderName: string;
100}
101/**
102 * @name CardIO
103 * @description
104 * @usage
105 * ```
106 * import { CardIO } from 'ionic-native';
107 *
108 *
109 * CardIO.canScan()
110 * .then(
111 * (res: boolean) => {
112 * if(res){
113 * let options = {
114 * requireExpiry: true,
115 * requireCCV: false,
116 * requirePostalCode: false
117 * };
118 * CardIO.scan(options);
119 * }
120 * }
121 * );
122 * ```
123 * @interfaces
124 * CardIOOptions
125 * CardIOResponse
126 */
127export declare class CardIO {
128 /**
129 * Check whether card scanning is currently available. (May vary by
130 * device, OS version, network connectivity, etc.)
131 *
132 * @returns {Promise<boolean>}
133 */
134 static canScan(): Promise<boolean>;
135 /**
136 * Scan a credit card with card.io.
137 * @param {CardIOOptions} options Options for configuring the plugin
138 * @returns {Promise<any>}
139 */
140 static scan(options?: CardIOOptions): Promise<CardIOResponse>;
141 /**
142 * Retrieve the version of the card.io library. Useful when contacting support.
143 * @returns {Promise<string>}
144 */
145 static version(): Promise<string>;
146}