Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Ionic 2 card.io cordova plugin doesn't work #68

Open
n2lose opened this issue Jun 16, 2017 · 6 comments
Open

Ionic 2 card.io cordova plugin doesn't work #68

n2lose opened this issue Jun 16, 2017 · 6 comments

Comments

@n2lose
Copy link

n2lose commented Jun 16, 2017

General information

IONIC INFO
global packages:
@ionic/cli-utils : 1.4.0
Cordova CLI : 7.0.1
Ionic CLI : 3.4.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.2.1
System:
Node : v6.10.3
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.10

Cordova Plugin Version: @ionic-native/card-io@3.12.1
Platform: Android
Device OS Version and Device: Nexus 6P, Android version 6.0.1

Issue description

Hi,
I followed all the instruction steps, installed the cordova plugin card.io as
described in https://github.com/card-io/card.io-Cordova-Plugin.

Here is my code handle camera scan :

model = {
  cardType: '',
  cardNumber: '',
  cardholderName: '',
  expiryMonth: '',
  expiryYear: '',
  expireDate: ''
}

carNumber: string = '';
expireDate: string = '';


setCardData(data: any) {
  this.model.cardType = data.cardType;
  this.model.cardholderName = data.cardholderName;
  this.model.cardNumber = data.cardNumber;
  this.model.expiryMonth = data.expiryMonth;
  this.model.expiryYear = data.expiryYear;
  this.model.expireDate = data.expiryMonth +"/"+ data.expiryYear;
}

scanButton() {

  this.cardIO.canScan()
    .then(
      (res: boolean) => {
        if(res){
          let options = {
            requireExpiry: true,
            requireCardholderName: true,
            scanExpiry: true
          };
          return this.cardIO.scan(options);
        }
      }
    )
    .then(res => {
      console.log(res);
      this.setCardData(res);
    }, err => {
      alert(err);
    });
}

I have tested on Samsung S7, but it doens't work.
I click button scanButton, the camera started to scan the credit card, then nothing happens or any data response.
Could someone take a look and help me please?

Regards,
Lam

@nickcom
Copy link

nickcom commented Jul 27, 2017

if you got the camera to even respond that is more than I was able to achieve with iOS. I've spent hours trying to get it to work and I've come to the conclusion that maybe this doesn't work with the current versions of phonegap. If someone can prove me wrong I'll be very happy!

@n2lose
Copy link
Author

n2lose commented Jul 27, 2017

I have re-test it with some variety cards, almost cards from banks in Vietnam don't have any response. But i tested with some cards in UK and AU, it works fine.

@davorpeic
Copy link

davorpeic commented Aug 2, 2017

+1 I thought I was using old version, updated all and when I call scan I see black screen and the app just crashes (ios)

edit: I found the issue with my crash, you need to add permission message in *.plist as mentioned in CardIO readme.. yeah, I know.. :)

<key>NSCameraUsageDescription</key>
<string>To scan credit cards.</string>

Tested with latest Ionic 3.6.0
dp

@carmo-evan
Copy link

+1. Camera opens, but no matter what credit card I use, the scan method never fires a response.

@uzbekjon
Copy link

uzbekjon commented Mar 31, 2018

This seems like a very old issue (over a year). I am having the same problem. Everything seems to work (camera opens with card.io UI), except that the .scan() does not return anything. The card finder rectangle is all green for several seconds and nothing.

@evan1024 have you resolved this issue?

PS. Tested using IonicDev app (iOS & Android) and on physical Android devise (Samsung A5). Forgot the iPhone cable. Will test on physical iOS devise tonight.

@uzbekjon
Copy link

After some digging I noticed that Card.io is using OpenCV library and it hit me that the source of the problem might be in a badly trained computer vision model. I guess the model has either been overfitted or not trained on diverse enough card images which lead to recognizing only popular US bank cards (which it was trained on).

Anyhow, tried the same not working app from before on American Express card, worked like a charm. Returned the card details as expected.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants