import Cardscan from 'react-native-cardscan';
.then(({action, payload, canceled_reason}) => {
if (action === 'scanned') {
const { number, expiryMonth, expiryYear, issuer, legalName } = payload;
} else if (action === 'canceled') {
if (canceled_reason === 'enter_card_manually') {
// the user elected to enter a card manually
} else if (canceled_reason === 'camera_error') {
// there was an error with the camera
} else if (canceled_reason === 'fatal_error') {
// there was an error during the scan
} else if (canceled_reason === 'user_canceled') {
// the user canceled the scan
// the scan was canceled for an unknown reason
} else if (action === 'skipped') {
} else if (action === 'unknown') {
// Unknown reason for scan canceled