I downloaded this plugin Magnetic Card Reader thanks to my limited experience I'm having issues. I'm using a square 3.5mm card reader the plugin according to the author is suppose to work with 3.5mm card reader. I have this code to start the card reader according to the documentations.
$scope.start = function () {
function cardReaderStart(cardReadSuccess, cardReadFailure) {
console.log("Card reader started!");
window.plugins.CardReaderPlugin.start(cardReadSuccess, cardReadFailure);
}
// If OS is Android
function cardReadSuccess(response) {
console.log("Card number:" + response[0].card_number);
if (typeof response[0].expiry_month != 'undefined' && response[0].expiry_month != null) {
console.log("Expiry month:" + response[0].expiry_month);
}
if (typeof response[0].expiry_year != 'undefined' && response[0].expiry_year != null) {
console.log("Expiry month:" + response[0].expiry_year);
}
}
//If OS is iOS
function cardReadSuccess(response) {
console.log("Card number:" + response['card_number']);
if (typeof response[0].expiry_month != 'undefined' && response[0].expiry_month != null) {
console.log("Expiry month:" + response['expiry_month']);
}
if (typeof response[0].expiry_year != 'undefined' && response[0].expiry_year != null) {
console.log("Expiry month:" + response['expiry_year']);
}
}
function cardReadFailure() {
console.log('Please try again!');
}
};
the problem is that after I click the $scope.start and then I proceed to swipe the credit card in the square card reader nothing happens.
I'm wondering what am I doing wrong? or if you guys know any other card reader plugin I can use.
Thank you :)