2

I am trying to implement Card.io in my app, I followed the instructions on Card.io website and when I get into my app and I launch it, it locks in on my card, but after that nothing else happens. Below is my code

AndroidManifest

<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.CAMERA"/>

<--!..........................-->

<activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" android:hardwareAccelerated="true"/>
<activity android:name="io.card.payment.DataEntryActivity" android:screenOrientation="portrait"/>

ActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == MY_SCAN_REQUEST_CODE) {
        String cardNumbs, cardExp, cardCVV;
        String resultStr;

        if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
            //TODO
            CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);

            cardNumbs = scanResult.getRedactedCardNumber();
            acctDebitCardNo.setText(cardNumbs);
            if (scanResult.isExpiryValid()) {
                cardExp = scanResult.expiryMonth + "/" + "20" + scanResult.expiryYear;
                acctDebitCardExp.setText(cardExp);
            } else {
                acctDebitCardExp.setError("Card Has Expired");
            }
            if (scanResult.cvv != null) {
                cardCVV = scanResult.cvv;
                acctDebitCardCvv.setText(cardCVV);
            }
        }
    }
}

Permission To Launch Camera

Intent scanIntent = new Intent(getActivity(), CardIOActivity.class);

        // customize these values to suit our/there needs...LOL :).
        scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true);
        scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, true);
        scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false
        // hides the manual entry button
        // if set, developers should provide their own manual entry mechanism in the app
        scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, false); // default: false
        // matches the theme of your application
        scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, true);

        // MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
        startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);

I don't know what I'm doing wrong

Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69
Tonespy
  • 3,257
  • 7
  • 26
  • 52
  • Dave from card.io here. Please try a variety of cards. card.io is limited to recognizing traditional-format credit cards with large embossed numbers. And it doesn't succeed in all cases even with those. – Dave Goldman Aug 17 '15 at 18:36
  • Hmm, I've tried it on 5 different cards with no success(Mostly Master Cards and Visa Cards). Since it wasn't working fine, we've decided to not use it. – Tonespy Aug 17 '15 at 19:09

3 Answers3

2

In my own case, the problem was that the card was not embossed (most Nigerian cards are not). Card.io and PayCards do not cater for embossed cards. If this scenario fits your case, you might need to build the scanner by yourself using Firebase MLKit. The whole process is less complex than it sounds. You can follow this guide to help you.

I hope this helps. Merry coding!

Taslim Oseni
  • 6,086
  • 10
  • 44
  • 69
1
  1. First you have to change the file extension of card.io-5.0.1.aar(its inside aars folder) into a zip file.from this link
  2. Once you changed the file, extract it.
  3. After extracted, copy all the files inside the jni folder and paste it inside your project's libs folder.
  4. and voila!.. it should work now! :)
Jera Balais
  • 61
  • 1
  • 9
  • I'm using the `Maven` based `repository` `compile 'io.card:android-sdk:5.0.1'` or does it apply to it too? – Tonespy Aug 17 '15 at 08:54
  • I've done that and still getting same not auto scanning behavior just locking on the card and nothing happening after – Tonespy Aug 17 '15 at 09:06
0

Is the card number embossed? See card-io/card.io-iOS-SDK#20 for a description of why non-embossed cards are not supported.

Binod Singh
  • 682
  • 4
  • 11
  • 22
  • I don't think your service can read any Nigerian card. Cause, I was an app using your library too. It wouldn't ready any Nigerian card either. – Tonespy Oct 18 '15 at 15:06