$ npm install react-native-card-connect --save
For RN Version < 0.60 (no autolinking)
$ react-native link react-native-card-connect
For RN Version > 0.60 (with autolinking) nothing needs to be done other than installing the package.
Add pod 'RNCardConnectReactLibrary', :path => '../node_modules/react-native-card-connect'
in your pod file for ios
import CardConnect from 'react-native-card-connect';
import moment from 'moment';
async tokenizeCard() {
try {
const siteId = "fts";
const cardNumber = "42424242424242";
const expiryDate = moment('12/22', 'MM/YY').toISOString();
const cVc = "123";
CardConnect.setupConsumerApiEndpoint(siteId + ".cardconnect.com:443");
const token = await CardConnect.getCardToken(
cardNumber,
expiryDate,
cVc
);
console.log(token)
} catch (error) {
console.log(error.toString());
}
}